{"id":17153894,"url":"https://github.com/stevenmmortimer/rdfp","last_synced_at":"2025-10-06T17:55:25.501Z","repository":{"id":56936838,"uuid":"46183233","full_name":"StevenMMortimer/rdfp","owner":"StevenMMortimer","description":"This R package connects the DoubleClick for Publishers API from R","archived":false,"fork":false,"pushed_at":"2020-07-23T16:30:39.000Z","size":6908,"stargazers_count":16,"open_issues_count":2,"forks_count":5,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-08-29T15:10:17.328Z","etag":null,"topics":["api-client","api-wrapper","dfp","dfp-api","doubleclick","doubleclick-for-publishers","google-dfp","r"],"latest_commit_sha":null,"homepage":"https://stevenmmortimer.github.io/rdfp/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StevenMMortimer.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-14T16:59:01.000Z","updated_at":"2023-12-13T00:51:06.000Z","dependencies_parsed_at":"2022-08-21T05:50:55.405Z","dependency_job_id":null,"html_url":"https://github.com/StevenMMortimer/rdfp","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/StevenMMortimer/rdfp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenMMortimer%2Frdfp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenMMortimer%2Frdfp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenMMortimer%2Frdfp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenMMortimer%2Frdfp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StevenMMortimer","download_url":"https://codeload.github.com/StevenMMortimer/rdfp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenMMortimer%2Frdfp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278655136,"owners_count":26022967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","api-wrapper","dfp","dfp-api","doubleclick","doubleclick-for-publishers","google-dfp","r"],"created_at":"2024-10-14T21:47:37.828Z","updated_at":"2025-10-06T17:55:25.472Z","avatar_url":"https://github.com/StevenMMortimer.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: \n  github_document:\n    html_preview: false\n---\n\n```{r, echo = FALSE, message = FALSE}\nknitr::opts_chunk$set(\n  out.width = '100%',\n  fig.align = 'center',\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\")\n```\n\n# rdfp\u003cimg src=\"man/figures/rdfp.png\" width=\"120px\" align=\"right\" /\u003e\n\n[![Build Status](https://travis-ci.org/StevenMMortimer/rdfp.svg?branch=master)](https://travis-ci.org/StevenMMortimer/rdfp)\n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/StevenMMortimer/rdfp?branch=master\u0026svg=true)](https://ci.appveyor.com/project/StevenMMortimer/rdfp)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/rdfp)](https://cran.r-project.org/package=rdfp)\n[![Coverage Status](https://codecov.io/gh/StevenMMortimer/rdfp/branch/master/graph/badge.svg)](https://codecov.io/gh/StevenMMortimer/rdfp?branch=master)\n\n**Compiled using DFP API version: `v201905`**\n\n**rdfp** allows you to use the DoubleClick for Publishers API from R (recently renamed \nto Google Ad Manager). Manage inventory, create orders, pull reports, and more!\n  \n## Table of Contents  \n  * [Installation](#installation)\n  * [Vignettes](#vignettes)\n  * [Usage](#usage)\n    * [Set API Version](#load-package-and-set-api-version)\n    * [Authenticate](#authenticate)\n    * [Get Current User Info](#get-current-user-info)\n    * [Pull a LineItem](#pull-a-lineitem)\n    * [Run a Report](#run-a-report)\n  * [Credits](#credits)\n  * [More Information](#more-information)\n\n## Installation\n\n```{r, eval = FALSE}\n# install from CRAN\ninstall.packages(\"rdfp\")\n\n# or get the latest version available on GitHub using the devtools package\n# install.packages(\"devtools\")\ndevtools::install_github(\"StevenMMortimer/rdfp\")\n```\n\nIf you encounter a clear bug, please file a minimal reproducible example on \n[GitHub](https://github.com/StevenMMortimer/rdfp/issues).\n\n## Vignettes\n\nThe README below outlines the package functionality, but review the vignettes for \nmore detailed examples on usage.\n\n  * [Administrative Tasks](https://StevenMMortimer.github.io/rdfp/articles/administrative-tasks.html)\n  * [Ad Trafficking Setup](https://StevenMMortimer.github.io/rdfp/articles/ad-trafficking-setup.html)\n  * [Manipulating Orders and LineItems](https://StevenMMortimer.github.io/rdfp/articles/manipulating-orders-and-lineitems.html)\n  * [Checking Availability](https://StevenMMortimer.github.io/rdfp/articles/checking-availability.html)\n  * [Pulling Reports](https://StevenMMortimer.github.io/rdfp/articles/pulling-reports.html)\n\n## Usage  \n\nAll functions start with `dfp_` so that you can easily identify DFP-specific \noperations and use tab completion in RStudio. Most **rdfp** functions will \nreturn a `tbl_df` or `list` parsed from the XML returned in the SOAP response.\n\n### Load Package and Set API Version\n\nGoogle releases 4 versions of the DFP API each year and deprecates versions older than \none year, so there is a lot that's regularly changing in this package. **rdfp** \nis periodically compiled against a recent version of the API. If you would like \nto use an older or newer API version that what is the package default, then just \nspecify it as an option.\n\n```{r load-package}\nlibrary(rdfp)\n# see the package default version\ngetOption(\"rdfp.version\")\n```\n\n```{r set-version, eval=FALSE}\n# this will force all calls to be against the version \"v201902\"\noptions(rdfp.version = \"v201902\")\n```\n\n### Authenticate\n\nTo authenticate you will first need to specify the `network_code` of the DFP instance \nyou would like to connect to. This is the only required option that the user must specify when \nusing the **rdfp** package. After setting the `network_code` all you need to do is \nrun `dfp_auth()`. If you already have a cached `.httr-oauth-rdfp` file in the current \nworking directory, then the token will be loaded and refreshed if necessary. Otherwise, \nyour browswer will pop open and you will interactively authenticate.\n\nThe package has other options like a client\\_id and client\\_secret where you can \nconnect using your own Google Client instead of the package default. Using your own \nclient requires you to first set one up in the \n[Google Developers Console](https://console.developers.google.com).\n\n```{r eval = FALSE}\noptions(rdfp.network_code = \"12345678\")\noptions(rdfp.application_name = \"MyApp\")\noptions(rdfp.client_id = \"012345678901-99thisisatest99.apps.googleusercontent.com\")\noptions(rdfp.client_secret = \"Th1s1sMyC1ientS3cr3t\")\n\n# dfp_auth will use the options above and cache an OAuth token in the working directory\n# the token will be refreshed when necessary\ndfp_auth()\n```\n\n```{r auth, include = FALSE}\ntoken_path \u003c- here::here(\"tests\", \"testthat\", \"rdfp_token.rds\")\nsuppressMessages(dfp_auth(token = token_path, verbose = FALSE))\noptions_path \u003c- here::here(\"tests\", \"testthat\", \"rdfp_options.rds\")\nrdfp_options \u003c- readRDS(options_path)\noptions(rdfp.network_code = rdfp_options$network_code)\n```\n\n### Get Current User Info\n\n```{r administrative-example}\n# Check current user or network\nuser_info \u003c- dfp_getCurrentUser()\nuser_info[,c('id', 'isActive')]\nnetwork_info \u003c- dfp_getCurrentNetwork()\nnetwork_info[,c('id', 'networkCode')]\n```\n\n#### Pull a LineItem\n\nThe function `dfp_getLineItemsByStatement()` function from the [LineItemService](https://developers.google.com/ad-manager/api/reference/v201905/LineItemService) \nallows you to retrieve Line Items by Publishers Query Language (PQL) statement. \nThe statement is constructed as a list of lists that are nested to emulate the \nhierarchy of the XML that needs to be created in the request. \n\n```{r lineitem-example}\n# Retrieve up to 3 Line Items that have a status of \"DELIVERING\"\nrequest_data \u003c- list('filterStatement'=list('query'=\"WHERE status='DELIVERING' LIMIT 3\"))\nresultset \u003c- dfp_getLineItemsByStatement(request_data, as_df=TRUE) \nresultset[,c('orderId', 'id', 'priority', 'deliveryRateType')]\n```\n\n### Run a Report\n\nBelow is an example of how to make a simple report request.\n\n```{r report-example}\n# In order to run a report you must specify how the report should be structured \n# by specifying a reportQuery inside a reportJob. All of the dimensions, columns, \n# date range options, etc. are documented at:\n# https://developers.google.com/ad-manager/api/reference/v201905/ReportService.ReportQuery\nrequest_data \u003c- list(reportJob=list(reportQuery=list(dimensions='MONTH_AND_YEAR', \n                                                     dimensions='AD_UNIT_ID',\n                                                     adUnitView='FLAT',\n                                                     columns = 'AD_SERVER_IMPRESSIONS', \n                                                     columns = 'AD_SERVER_CLICKS',\n                                                     dateRangeType='LAST_WEEK'\n                                                     )))\n\n# a convenience function has been provided to you to manage the report process workflow\n# if you would like more control, see the example below which moves through each step in the process\nreport_data \u003c- dfp_full_report_wrapper(request_data)\nreport_data[,c('Dimension.MONTH_AND_YEAR', 'Dimension.AD_UNIT_ID', 'Column.AD_SERVER_CLICKS')]\n```\n\n## Credits\n\nThis application uses other open source software components. The authentication \ncomponents are mostly verbatim copies of the routines established in the **googlesheets** \npackage (https://github.com/jennybc/googlesheets). We acknowledge and are grateful \nto these developers for their contributions to open source.\n\n## More Information\n\nGoogle provides support for client libraries [here](https://developers.google.com/ad-manager/api/clients), \nbut unfortunately, R is not a supported language. Google's client libraries directly \nreference the production WSDLs to interact with the API, but this package makes \nSOAP requests best formatted to match the WSDL standards. This articulation is not \nperfect and continued progress will be made to bring functionality up to par with \nthe client libraries. \n\nMost all operations supported by the DFP API are available \nvia this package. It is strongly recommended that you use the \n[DFP API Reference](https://developers.google.com/ad-manager/api/rel_notes) \nwhen using this package. Details on formatting, attributes, and methods are all \nbetter explained by Google's documentation.\n\nMore information is also available on the `pkgdown` site at https://StevenMMortimer.github.io/rdfp/.  \n\n[Top](#rdfp)\n\n---\nPlease note that this project is released with a [Contributor Code of Conduct](https://github.com/StevenMMortimer/rdfp/blob/master/CONDUCT.md).\nBy participating in this project you agree to abide by its terms.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevenmmortimer%2Frdfp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevenmmortimer%2Frdfp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevenmmortimer%2Frdfp/lists"}