Reporting API - filter by custom tageting key name or key id

1,620 views
Skip to first unread message

vbarsegh...@gmail.com

unread,
Apr 11, 2017, 9:31:58 PM4/11/17
to Google's DoubleClick for Publishers API Forum
Hello,

Want to clarify, can we use reporting API and filter results by CUSTOM_TARGETING_KEY_ID for example.


I have a code snippet like 

        $date = Carbon::createFromFormat('Y-m-d', date('Y-m-d', strtotime($when)));

        /** @var \Google\AdsApi\Dfp\v201611\ReportService $reportService */
        $reportService = $this->getServiceByType('ReportService');

        $reportQuery = new ReportQuery();
        $reportQuery->setAdUnitView('FLAT');
        $reportQuery->setDateRangeType('CUSTOM_DATE');
        $reportQuery->setStartDate(new DfpDate($date->year, $date->month, $date->day));
        $reportQuery->setEndDate(new DfpDate($date->year, $date->month, $date->day));

        $reportQuery->setDimensions(['ADVERTISER_ID', 'ADVERTISER_NAME', 'AD_UNIT_NAME', 'CUSTOM_CRITERIA']);
        $reportQuery->setColumns([
            'TOTAL_CODE_SERVED_COUNT',
            'TOTAL_LINE_ITEM_LEVEL_CPM_AND_CPC_REVENUE',
        ]);

        $statementBuilder = new StatementBuilder();
        $statementBuilder->where("WHERE ADVERTISER_ID IN ({$this->dfpAdvertisersList->implode(',')})");

Want to add condition like

        $statementBuilder->where("WHERE CUSTOM_TARGETING_KEY_ID = xxxxx");

And getting message like

'customTargetingKeyId' is not filterable

Is there some way to filter, instead of trying to get CUSTOM_TARGETING_VALUE_ID's by CUSTOM_TARGETING_KEY_ID  and then try to filter by CUSTOM_TARGETING_VALUE_ID's ?

Thanks

Vincent Racaza (DFP API Team)

unread,
Apr 12, 2017, 12:02:30 AM4/12/17
to Google's DoubleClick for Publishers API Forum
Hi,

Currently, filtering by custom targeting key id is not supported in the API. However, you can directly filter the report by CUSTOM_TARGETING_VALUE_ID:
.where("CUSTOM_TARGETING_VALUE_ID = 123456789")

You can follow our blog for any future updates like new releases.

Let me know if you have further clarifications.

Thanks,
Vincent Racaza, DFP API Team

vbarsegh...@gmail.com

unread,
Apr 12, 2017, 11:01:23 PM4/12/17
to Google's DoubleClick for Publishers API Forum
Hi Vincent,

Thanks, this is all that I want to clarify.

Regards

brend...@hivemedia.com

unread,
Mar 16, 2018, 12:18:57 PM3/16/18
to Google's DoubleClick for Publishers API Forum
Hi. I just wanted to bump this thread and see if there was any development for filtering "CUSTOM_TARGETING_KEY_ID" in future updates? We have up to 100K value ids per key and would appreciate the ability to filter on key id.

Vincent Racaza (DFP API Team)

unread,
Mar 18, 2018, 11:30:58 PM3/18/18
to Google's DoubleClick for Publishers API Forum
Hi,

There is still no equivalent dimension for "Custom Targeting Key ID" in the DFP API reports. You can only include the CUSTOM_CRITERIA and CUSTOM_TARGETING_VALUE_ID dimensions in your report and only the CUSTOM_TARGETING_VALUE_ID is filterable.

You can follow our blog to receive any future updates like new releases.

con...@publicisventure.com

unread,
May 23, 2018, 12:04:16 PM5/23/18
to Google's DoubleClick for Publishers API Forum
Hi Vincent,

Any ETA for this feature ? 

Thanks

Message has been deleted

Daniel McAuley

unread,
May 31, 2018, 9:54:45 AM5/31/18
to Google's DoubleClick for Publishers API Forum
Subscribing to the topic.

For now what I do is tedious as I imagine for everyone else: create report that includes dimension: CUSTOM_CRITERIA, then iterate over CSV to select wanted key-value pairs and data. The report is needlessly taking up excess computing power for google and users. My report queries take on average 15 seconds/requested day count to resolve, the ability to filter at the report argument level by statement would be a huge improvement. 

Vincent Racaza (DFP API Team)

unread,
May 31, 2018, 10:03:15 AM5/31/18
to Google's DoubleClick for Publishers API Forum
Hi Daniel,

I understand your concern, however, I don't have a definite timeline on if and when this (filter by CUSTOM_CRITERIA) will be supported in the DFP API. Please continue to follow our blog to receive any future updates like new releases.

vbarsegh...@gmail.com

unread,
Sep 12, 2018, 10:14:30 PM9/12/18
to Google Ad Manager API Forum
Hey Vincent,

Seems I've faced an issue. I have key, which has a list of values, where count is 2,794, and I'm pulling data by filtering them by values chunked 500 items per request. 

Count of results that I'm getting are different from the report from DFP UI. I have compared even by counting rows in CSV files manually, they are different.

How it is possible? Is that mean, that I'm doing something wrong ?  

Vincent Racaza (DFP API Team)

unread,
Sep 13, 2018, 12:52:09 AM9/13/18
to Google Ad Manager API Forum
Hi,

Both Ad Manager UI and API should have the same number of custom targeting values per custom targeting key. Have you checked in the API result if there are inactive custom targeting values? In the API, all active and inactive custom targeting values are retrieved so you need to check if your UI result has also returned both active and inactive custom targeting values.

If you can confirm that you applied the same filters (e.g. checking on active custom targeting values only) when checking the API and UI custom targeting values for a certain key, can you provide the SOAP request and response logs so I can further check? You may use the Reply privately to author option.

Thanks,
Vincent Racaza, Ad Manager API Team
Reply all
Reply to author
Forward
0 new messages