StevenMMortimer / rdfp

This R package connects the DoubleClick for Publishers API from R
https://stevenmmortimer.github.io/rdfp/
Other
16 stars 5 forks source link

Creating Filter Statement within "dfp_full_report_wrapper" #14

Closed tfan666 closed 4 years ago

tfan666 commented 4 years ago

Hi Steven

You package helps me a lot! I have quick question regarding function "dfp_full_report_wrapper". Am I able to apply any filter Statement within this function or is any other function in rdfp I can use to do the same thing? The purpose is to pull a report from Google AdManager. My query is as below but it took so long to query. I wish i could add a filter statement like "WHERE CUSTOM_CRITERIA LIKE %keyword% ".

Thanks a lot!

A <- list( reportJob=list( reportQuery=list( dimensions= 'DATE', dimensions= 'CUSTOM_CRITERIA', dimensions= 'CREATIVE_SIZE_DELIVERED', dimensions= 'LINE_ITEM_TYPE', dimensions= 'LINE_ITEM_NAME', columns= 'AD_SERVER_CPM_AND_CPC_REVENUE', columns= 'AD_SERVER_IMPRESSIONS', startDate= list(year=2019, month=09, day=07), endDate= list(year=2019, month=12, day=04), dateRangeType='CUSTOM_DATE') ))

A <- dfp_full_report_wrapper(A, max_tries = Inf, check_interval = 3)

StevenMMortimer commented 4 years ago

@tfan666 Yes, just include a statement argument in your Report Query like this:

A <- list(
  reportJob = list(
    reportQuery = list(
      dimensions = 'DATE',
      dimensions = 'CUSTOM_CRITERIA',
      dimensions = 'CREATIVE_SIZE_DELIVERED',
      dimensions = 'LINE_ITEM_TYPE',
      dimensions = 'LINE_ITEM_NAME',
      columns = 'AD_SERVER_CPM_AND_CPC_REVENUE',
      columns = 'AD_SERVER_IMPRESSIONS',
      startDate = list(year=2019, month=09, day=07),
      endDate = list(year=2019, month=12, day=04),
      dateRangeType = 'CUSTOM_DATE')
      statement = list(query = "WHERE status='DELIVERING' LIMIT 3")
    )
  )
)

The documentation for how to construct the Statement.query expression is here: https://developers.google.com/ad-manager/api/reference/v201911/ReportService.Statement.html#query