Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching data for a Custom Dimension created in DFP #13

Open
achyutanand opened this issue Aug 1, 2019 · 2 comments
Open

Fetching data for a Custom Dimension created in DFP #13

achyutanand opened this issue Aug 1, 2019 · 2 comments
Assignees
Labels
question or help Clarification or help may suffice to resolve

Comments

@achyutanand
Copy link

Hi,

This is my query-
request_data <- list(reportJob =
list(reportQuery =
list(dimensions = 'MONTH_AND_YEAR',
dimensions = 'floorTest (floortest)', #customDimension created in DFP
dimensions = 'AD_UNIT_NAME',
dimensions = 'ADVERTISER_NAME',
dimensions = "PLACEMENT_NAME",
dimensions = "COUNTRY_NAME",
dimensions = "DEVICE_CATEGORY_NAME",
dimensions = 'LINE_ITEM_NAME',
adUnitView = 'FLAT',
columns = 'TOTAL_LINE_ITEM_LEVEL_CPM_AND_CPC_REVENUE',
columns = "TOTAL_LINE_ITEM_LEVEL_IMPRESSIONS",
columns = 'TOTAL_UNFILLED_IMPRESSIONS',
columns = 'TOTAL_CPM_AND_CPM_IMPRESSIONS',
startDate=list(year=2019, month=7, day=1),
endDate=list(year=2019, month=7, day=1),
dateRangeType='CUSTOM_DATE')))
report_data <- dfp_full_report_wrapper(request_data)

When the data is pulled, the data frame has the columns- "Dimension.MONTH_AND_YEAR", "Dimension.AD_UNIT_NAME", "Dimension.ADVERTISER_NAME", "Dimension.PLACEMENT_NAME", "Dimension.COUNTRY_NAME", "Dimension.DEVICE_CATEGORY_NAME", "Dimension.LINE_ITEM_NAME", "Dimension.AD_UNIT_ID", "Dimension.ADVERTISER_ID", "Dimension.PLACEMENT_ID", "Dimension.COUNTRY_CRITERIA_ID", "Dimension.DEVICE_CATEGORY_ID", "Dimension.LINE_ITEM_ID", "Column.TOTAL_LINE_ITEM_LEVEL_CPM_AND_CPC_REVENUE"
, "Column.TOTAL_LINE_ITEM_LEVEL_IMPRESSIONS"

The column which is missing is floorTest (floortest) which is a custom dimension created in DFP.

What should be done to get the data from the custom dimension?

Thanks,

@StevenMMortimer StevenMMortimer self-assigned this Aug 1, 2019
@StevenMMortimer StevenMMortimer added the question or help Clarification or help may suffice to resolve label Aug 1, 2019
@StevenMMortimer
Copy link
Owner

StevenMMortimer commented Aug 1, 2019

@achyutanand According to the API documentation you must provide a dimension called CUSTOM_DIMENSION and then include the customDimensionKeyIds element in your list.

Here is a link to the documentation: https://developers.google.com/ad-manager/api/reference/v201905/ReportService.ReportQuery#customdimensionkeyids

Here is some sample code, but you will need to adapt for your purposes:

request_data <- list(reportJob =
list(reportQuery =
list(dimensions = 'MONTH_AND_YEAR',
dimensions = 'CUSTOM_DIMENSION',
dimensions = 'AD_UNIT_NAME',
dimensions = 'ADVERTISER_NAME',
dimensions = "PLACEMENT_NAME",
dimensions = "COUNTRY_NAME",
dimensions = "DEVICE_CATEGORY_NAME",
dimensions = 'LINE_ITEM_NAME',
adUnitView = 'FLAT',
columns = 'TOTAL_LINE_ITEM_LEVEL_CPM_AND_CPC_REVENUE',
columns = "TOTAL_LINE_ITEM_LEVEL_IMPRESSIONS",
columns = 'TOTAL_UNFILLED_IMPRESSIONS',
columns = 'TOTAL_CPM_AND_CPM_IMPRESSIONS',
customDimensionKeyIds = list(TOP_LEVEL_DIMENSION_KEY[id]_ID, TOP_LEVEL_DIMENSION_KEY[id]_VALUE),
startDate=list(year=2019, month=7, day=1),
endDate=list(year=2019, month=7, day=1),
dateRangeType='CUSTOM_DATE')))
report_data <- dfp_full_report_wrapper(request_data)

@sapirm290
Copy link

The above solution is not accuarate. the customDimensionKeyIds has to be a list with the custom_dimension keys. like so [190434353,19042142].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question or help Clarification or help may suffice to resolve
Projects
None yet
Development

No branches or pull requests

3 participants