Adsense Reports using Apps Script

105 views
Skip to first unread message

Belem Transito

unread,
Oct 23, 2023, 9:11:03 AM10/23/23
to AdSense API Forum
Guys, I've been having some difficulty making adsense reports using APPs Script. I have already made several configuration changes to authorization/credentials and the error that appears when I enter google sample code: 

the error:

HttpResponseException: Response Code: 404. Message: <!DOCTYPE html> <html lang=en> <meta charset=utf-8> <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width"> <title>Error 404 (Not Found)!!1</title> <style> *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//w....
Code.gs:29

Any help, please?!

Ad Sense API

unread,
Oct 23, 2023, 9:21:42 AM10/23/23
to belemt...@gmail.com, adsen...@googlegroups.com
Hi Belem,

I think that what you're seeing here is that the Apps Script IDE does not pass parameter values into functions when you run them interactively.

In this case you have (from https://developers.google.com/apps-script/advanced/adsense#list_ad_clients):
 
function listAdClients(accountName) {
  [...]
}
and so running that will pass an empty value into the accountName parameter, producing the result that you're seeing.

Instead, you can create a helper function similar to:
 
function run() {
  listAdClients("accounts/pub-1234");  // from Account.name, as returned by Accounts.list.
}

and then running that interactively should work the way that you expect.

Thanks,
Malcolm (AdSense API team)

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