statementBuilder = (ad_manager.StatementBuilder()
#.Where('CUSTOM_TARGETING_VALUE_ID in (321484)')
#.WithBindVariable('crit', long(321484))
.Limit(None) # No limit or offset for reports
.Offset(None)
)
report_job = {
'reportQuery': {
'dimensions': ['DATE',
# No dartUserID
'PROPOSAL_ID',
'PROPOSAL_LINE_ITEM_ID',
'PACKAGE_ID'
'ORDER_ID',
'LINE_ITEM_ID',
'CUSTOM_CRITERIA'
],
'statement':statementBuilder.ToStatement(),
'contentMetadataKeyHierarchyCustomTargetingKeyIds':[321484],
'columns': ['AD_SERVER_TARGETED_IMPRESSIONS', 'AD_SERVER_TARGETED_CLICKS'],
# 'dateRangeType': 'LAST_MONTH'
'dateRangeType': 'CUSTOM_DATE',
'startDate': {'year': incrementStartDate.year, 'month': incrementStartDate.month,
'day': incrementStartDate.day},
'endDate': {'year': incrementEndDate.year, 'month': incrementEndDate.month, 'day': incrementEndDate.day}
}
}
===============================================================================
If I leave off the part that does this:
'contentMetadataKeyHierarchyCustomTargetingKeyIds':[321484],My report is broken out by all of the keywords.I'm not sure where I'm going wrong, but the code above produces this error:googleads.errors.GoogleAdsServerFault: [ReportError.INVALID_CONTENT_HIERARCHY_DIMENSIONS @ ]Any help would be appreciated.
statementBuilder = (ad_manager.StatementBuilder()
.Where('CUSTOM_TARGETING_VALUE_ID in (:crit)')
.WithBindVariable('crit', long(321484))
.Limit(None) # No limit or offset for reports
.Offset(None)
)
Or even:
statementBuilder = (ad_manager.StatementBuilder()
.Where('CUSTOM_TARGETING_VALUE_ID in (321484)')
.Limit(None) # No limit or offset for reports
.Offset(None)
)
I return empty files. That is because the filtering is off.Seeing that it works, but just returns nothing, I then took off the filter from the statementBuilder. My hunch is that filtering the value is actually filtering the ID that represents the combination of the key Id and the value.
| Dimension.CUSTOM_CRITERIA | Dimension.CUSTOM_TARGETING_VALUE_ID |
| pos=1 | 51367119964 |
| plat=sf5 | 447921127044 |
| plat=dep | 447921273176 |
| plat=dep | 447921273176 |
| plat=sf5 | 447921127044 |
| plat=dep | 447921273176 |
statementBuilder = (ad_manager.StatementBuilder()
.Where('CUSTOM_TARGETING_VALUE_ID in (:crit)')
.WithBindVariable('crit', long(447921273176))
.Limit(None) # No limit or offset for reports
.Offset(None)
)
CONTENT_HIERARCHY_CUSTOM_TARGETING_KEY[id]_ID and CONTENT_HIERARCHY_CUSTOM_TARGETING_KEY[id]_VALUE where where ID is the ID of thecustom targeting value and VALUE is the name.To add IDs, you must include Dimension.CONTENT_HIERARCHY in dimensions, and specify a non-empty list of custom targeting key IDs. The order of content hierarchy columns in the report correspond to the place of Dimension.CONTENT_HIERARCHY in dimensions. For example, if dimensions contains the following dimensions in the order: Dimension.ADVERTISER_NAME,Dimension.CONTENT_HIERARCHY and Dimension.COUNTRY_NAME, and contentMetadataKeyHierarchyCustomTargetingKeyIds contains the following IDs in the order: 1001 and 1002. The order of dimensions in the report will be: Dimension.ADVERTISER_NAME, Dimension.CONTENT_HIERARCHY_CUSTOM_TARGETING_KEY[1001]_VALUE, Dimension.CONTENT_HIERARCHY_CUSTOM_TARGETING_KEY[1002]_VALUE, Dimension.COUNTRY_NAME, Dimension.ADVERTISER_ID, Dimension.CONTENT_HIERARCHY_CUSTOM_TARGETING_KEY[1001]_ID, Dimension.CONTENT_HIERARCHY_CUSTOM_TARGETING_KEY[1002]_ID, Dimension.COUNTRY_CRITERIA_ID