Ad performance script not working

93 views
Skip to first unread message

Jelena Savović

unread,
Mar 12, 2024, 4:50:16 AM3/12/24
to Google Ads Scripts Forum
Hi,

I have just tried to run Ad performance report script.

It gives me this error:

TypeError: segments is not iterable at outputSegmentation (Code:230:27) at main (Code:118:3) at Object.<anonymous> (adsapp_compiled:20662:54)



Can you please tell me what is wrong?

Thank you

Jelena

Google Ads Scripts Forum

unread,
Mar 12, 2024, 3:27:55 PM3/12/24
to Google Ads Scripts Forum
Hi Jelena,

Thank you for reaching out to the Google Ads Scripts support team.

By reviewing your concern, I understand that you are getting an error "TypeError: segments is not iterable"  while running the script.

Kindly provide us with the below details to further investigate your issue:
  • Google Ads account ID / CID
  • Name of the script
  • Also, if the script uses a spreadsheet, please provide a shareable link to the spreadsheet. You can follow this guide to share a file publicly.
You can send the details via Reply privately to the author option or a direct private reply to this email.

Regards
Google Ads Scripts support team.

Jelena Savović

unread,
Mar 13, 2024, 5:39:16 AM3/13/24
to Google Ads Scripts Forum
Hi, 

Thank you for your response.

Google Ads account ID / CID: 838-651-1395

Name of the script: 
Ad Performance Script
There is another script, they are the same, one with a copy-pasted source code, and the other one I sent you is a template.

Spreadsheet shareable link with edit access: 
https://docs.google.com/spreadsheets/d/18x2nPMsvpyqRXUc6y6xfj-K9Zid219r823tHFYg4E9A/edit?usp=sharing 

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to a topic in the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/lmQR7Y-bWnI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/aa773333-37c1-41f9-9a97-4d7ab1b9b40cn%40googlegroups.com.

Google Ads Scripts Forum Advisor

unread,
Mar 13, 2024, 12:09:35 PM3/13/24
to adwords...@googlegroups.com
Hi,


Thank you for reaching out to the Google Ads Scripts support team.

Upon checking your scripts I found that you are getting the  error ‘Please specify a valid Spreadsheet URL’ while previewing the script. In order to resolve this error you need to replace  the line number 53 in your code.js file with the below code snippet.

'spreadsheet_url': 'YOUR_SPREADSHEET_URL' to 'spreadsheet_url': 'https://docs.google.com/spreadsheets/d/18x2nPMsvpyqRXUc6y6xfj-K9Zid219r823tHFYg4E9A/edit?pli=1#gid=12'

Also it is observed that you are getting the error ‘TypeError: segments is not iterable’ to resolve this error you need to add below code snippet in your code.js file.


   if(segments === Array) {
    
    for (const segment of segments) {
                           
      if (!segmentMap[segment]) {
        segmentMap[segment] =
            {numAds: 0, totalImpressions: 0, totalClicks: 0, totalCost: 0.0};
      }

I hope it helps, kindly get back to us if you have any further questions.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02rzuIJ:ref" (ADR-00227079)

Thanks,
 
Google Logo Google Ads Scripts Team


Reply all
Reply to author
Forward
0 new messages