Google Ad Reporting Summary

39 views
Skip to first unread message

Dorian Lee

unread,
Jun 19, 2024, 1:44:48 AM (2 days ago) Jun 19
to Google Ads Scripts Forum
hey guys

I am trying to use ad script to transfer data to Google sheet. However, i got an error 

ReferenceError: CONFIG is not defined (line 1)

you can find my config code below. 

/**
 * Configuration to be used for the Account Summary Report.
 */

CONFIG = {
  // URL of the report spreadsheet. This should be a copy of
  // https://docs.google.com/spreadsheets/d/1gYLXtDK93lWoTe3OBKvTlfcc7L_qHJFgWU9N6HwhZtU/copy
  'spreadsheet_url': 'https://docs.google.com/spreadsheets/d/1Jk-EKK8NGnjV5NbMKzADcWPsqxTriyz7J-hgLZRm0Wc/edit?gid=0#gid=0',
  // More reporting options can be found at
  // https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp#report_2
  'reporting_options': {
    // Comment out the following line to default to the latest reporting
    // version.
    'apiVersion': 'v10'
  },
  /**
   * To add additional fields to the report, follow the instructions at
   * https://developers.google.com/google-ads/scripts/docs/solutions/account-summary#extending_the_report_optional
   */
  'report_fields': [
    {'columnName': 'metrics.cost_micros', 'displayName': 'Cost'},
    {'columnName': 'metrics.average_cpc', 'displayName': 'Avg. CPC'},
    {'columnName': 'metrics.ctr', 'displayName': 'CTR'},
    {'columnName': 'metrics.search_impression_share', 'displayName': 'Search Impr. share'},
    {'columnName': 'metrics.impressions', 'displayName': 'Impressions'},
    {'columnName': 'metrics.clicks', 'displayName': 'Clicks'}
  ]
};


dont really know how to solve it. would appreciate your help!
thank you

Google Ads Scripts Forum Advisor

unread,
Jun 19, 2024, 2:53:36 AM (2 days ago) Jun 19
to adwords...@googlegroups.com

Hi,

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

I would suggest you to use the Source code available in the Google Ads Scripts solutions tab for account summary report. Kindly change the reporting version in the line 58 as ‘v16’ or else comment out the ‘apiVersion’ line to set it to the latest version.

I hope this helps. If the issue still persists even after following the above steps, Kindly get back to us with the below details.

  • Google Ads account ID/CID
  • Name of the affected script
  • Shareable spreadsheet link if you are using in your script
You can share the requested details via Reply privately to the author option or a direct private reply to this email. 

This message is in relation to case "ref:!00D1U01174p.!5004Q02tJOc4:ref" (ADR-00242402)

Thanks,
 
Google Logo Google Ads Scripts Team


Dorian Lee

unread,
Jun 19, 2024, 9:39:29 PM (2 days ago) Jun 19
to Google Ads Scripts Forum

Hey dear Scripts Team

i can only replay to all which is frustrating..

unfortunately I can’t use the source code directly as we need to make customization to the reporting format and metrics.

You can find the required details below:

Regards

Google Ads Scripts Forum Advisor

unread,
Jun 20, 2024, 3:41:59 AM (yesterday) Jun 20
to adwords...@googlegroups.com
Hi,

Based on the provided information, I could see that you've encountered the error "ReferenceError: CONFIG is not defined" while running a script. I would like to inform you that you are getting an error message because the CONFIG variable is not defined in your script. In order to fix this error, I suggest you make sure that the variable config is defined in the script. You can do this by adding the below code to your script and let us know if you still encounter the error. 
  'reporting_options': {
    // Comment out the following line to default to the latest reporting
    // version.
    'apiVersion': 'v16'
  },
  /**
   * To add additional fields to the report, follow the instructions at
   * https://developers.google.com/google-ads/scripts/docs/solutions/account-summary#extending_the_report_optional
   */
  'report_fields': [
    {'columnName': 'metrics.cost_micros', 'displayName': 'Cost'},
    {'columnName': 'metrics.average_cpc', 'displayName': 'Avg. CPC'},
    {'columnName': 'metrics.ctr', 'displayName': 'CTR'},
    {'columnName': 'metrics.search_impression_share', 'displayName': 'Search Impr. share'},
    {'columnName': 'metrics.impressions', 'displayName': 'Impressions'},
    {'columnName': 'metrics.clicks', 'displayName': 'Clicks'}
  ]
};
const SPREADSHEET_URL = CONFIG.spreadsheet_url;

Dorian Lee

unread,
Jun 20, 2024, 5:25:19 AM (yesterday) Jun 20
to Google Ads Scripts Forum
just tried this and encounter the same issue.. 

Nguyễn Thu Hoài

unread,
Jun 20, 2024, 7:40:42 AM (24 hours ago) Jun 20
to Google Ads Scripts Forum

Hi Scripts Team,
I want to export a report to see how the performance max campaign's impressions are distributed across networks. I used this code to upload the script but I get an error. Please help me see what I need to do to fix it.

Reply all
Reply to author
Forward
0 new messages