Metrics & Dimensions Compatibility

23 views
Skip to first unread message

Masood Anwer

unread,
May 14, 2024, 5:37:29 AMMay 14
to AdSense API Forum
I would like to create top pages report in apps script but I have found metrics & dimensions comatibility issue. Please share any suggestions & solutions. Here is sample API call.

const report = AdSense.Accounts.Reports.generate("accounts/XXXX", {
    filters: ['DOMAIN_NAME=@' + 'abc.com'],
    metrics: ['ESTIMATED_EARNINGS', 'PAGE_VIEWS', 'PAGE_VIEWS_RPM', 'CLICKS'],
    dimensions: ['PAGE_URL'],
    orderBy: ['+PAGE_VIEWS']
  });
  Logger.log("report = " + report);

Ad Sense API

unread,
May 16, 2024, 3:45:12 AMMay 16
to masoo...@gmail.com, adsen...@googlegroups.com
Hi Masood,

Thanks for your question. The warning is because the PAGE_URL dimension is only available for AdSense for Content (see https://support.google.com/adsense/answer/11988478). If you include "PRODUCT_CODE==AFC" in the filters for your request, the incompatibility warning should go away.

You might still find you get no results however, unless your site has a lot of traffic: the support page linked above states "Pages need to receive a minimum number of impressions to be eligible for this breakdown".

I hope this helps,
Andrew (AdSense API team)

ref:!00D1U01174p.!5004Q02tIy27:ref
Reply all
Reply to author
Forward
0 new messages