How make filter for Custom Dimensions

95 views
Skip to first unread message

Can Aktepe

unread,
Jun 15, 2022, 3:52:42 PM6/15/22
to Google Ad Manager API Forum
I want to pull custom dimension with filter. I tried any solutions for it. But I didn't.

When I put where statement, my code given error. Can anyone help me with this?

My code example as below;

Dimension[] dimensions = new Dimension[] {
       Dimension.CUSTOM_DIMENSION,
       Dimension.DATE,
       Dimension.COUNTRY_CODE,
       Dimension.AD_UNIT_NAME,
       Dimension.DEVICE_CATEGORY_ID,
       Dimension.DEVICE_CATEGORY_NAME,
};

Column[] columns = new Column[]
{
       Column.TOTAL_LINE_ITEM_LEVEL_IMPRESSIONS,
       Column.TOTAL_LINE_ITEM_LEVEL_CPM_AND_CPC_REVENUE,
       Column.TOTAL_AD_REQUESTS
}; 

DimensionAttribute[] dimensionAttributes = new DimensionAttribute[] 
{
        DimensionAttribute.AD_UNIT_CODE 
};

long[] customDimensionKey = { 11997906, 11074198 };

statementBuilder = new StatementBuilder();
                .Where("customTargetingValueId IN (448162267794)");
                .AddValue("id", targetingValues);

Ad Manager API Forum Advisor

unread,
Jun 15, 2022, 6:29:36 PM6/15/22
to google-doubleclick...@googlegroups.com
Hi Can Aktepe,

Thank you for reaching out to the Ad Manager API support team, this is Madhushree.

Upon checking your concerns, the IN condition is used to compare the value of a property to each item in a list,which means you have to provide at least more than one value, where you have provided only one Id in "where" condition. Hence, I would suggest you to use = (equals to) instead of IN as you are trying with a single Id. Please refer to the PQL guide for more information.

If you still face any issues please provide us with an error screenshot and complete SOAP request and response logs(enabled) for further investigation.

Regards,
Google Logo
Madhushree
Ad Manager API Team
 

 

ref:_00D1U1174p._5004Q2bwmit:ref

Can Aktepe

unread,
Jun 16, 2022, 2:49:52 AM6/16/22
to Google Ad Manager API Forum
This is error message for (equals =) or (IN keyword)    -   new StatementBuilder().Where("customTargetingValueId = 448162267794")
dfp-error.jpg

Thanks for the answer, but I already know. Actually, I just shared the code as an example. Normally I use =(equals to) when I'm only going to make 1 filter

I also get an error when I change to it or multiple values for the IN keyword

Ad Manager API Forum Advisor

unread,
Jun 16, 2022, 7:07:28 AM6/16/22
to google-doubleclick...@googlegroups.com
Hi Can Aktepe,

Thank you for getting back. I'm Ankam, colleague of Madhushree.

The CUSTOM_TARGETING_VALUE_ID can be used for filtering the report. From the Report service, report query the API doesn't support filtering on custom targeting keys mentioned in the CUSTOM_CRITERIA dimension description. The API only supports filtering on values (CUSTOM_TARGETING_VALUE_ID) under a key. For further clarity, if you want to filter reporting data on a specific key via API, then you will need to filter on all values under that key. Please provide us complete SOAP request and response logs(logging must be enabled) for further investigation.

Regards,
Google Logo
Ankam
Ad Manager API Team
 

 



ref:_00D1U1174p._5004Q2bwmit:ref
Reply all
Reply to author
Forward
0 new messages