Google Ads Script TypeError (AdsApp.getGoogleAdsService is not a function)

15 views
Skip to first unread message

codescribe77

unread,
Aug 19, 2025, 10:32:32 PMAug 19
to Google Ads Scripts Forum

I've been working with Gemini (Google's AI model) to build an Impression Share report, and we've hit a roadblock that appears to be related to my script environment.

My Objective: I aim to create a Google Ads Script that generates a daily email report on campaign and ad group Search Impression Share, including crucial investigative metrics such as:

  • metrics.search_impression_share_lost_due_to_budget

  • metrics.search_impression_share_lost_due_to_rank

  • metrics.search_absolute_top_impression_share

The Problem: When attempting to run the script, I consistently receive the following TypeError: TypeError: AdsApp.getGoogleAdsService is not a function

Context and Troubleshooting Steps Taken (with Gemini's assistance):

  1. New UI Confirmation: I can confirm that my Google Ads account's script editor displays the modern, multi-tabbed interface with a "Files" pane on the left, consistent with the new Google Ads Scripts experience. I do not see any explicit "Engine" or "Version" toggle within the editor.

  2. Initial Metric Errors: When first attempting to query the investigative metrics (search_impression_share_lost_due_to_budget, search_impression_share_lost_due_to_rank) using AdsApp.report(), I received QueryError.UNRECOGNIZED_FIELD errors.

  3. Attempted AdsApp.getGoogleAdsService(): Based on Gemini's advice, we transitioned the script to use AdsApp.getGoogleAdsService().search() to access the newer API capabilities required for these metrics. This is when the TypeError: AdsApp.getGoogleAdsService is not a function began to appear.

  4. Date Formatting Confirmed: We ensured that dynamic date calculations (for "yesterday") are correctly formatted as YYYY-MM-DD using Utilities.formatDate() and the account's timezone.

  5. Syntax Debugging: Gemini has thoroughly reviewed and corrected all potential syntax errors (like the ReferenceError and stray comments within GAQL strings) to ensure the code itself is syntactically sound.

  6. New Script Creation: As a last resort, I followed Gemini's suggestion to create a brand new script from scratch and paste the code that uses AdsApp.getGoogleAdsService().search() into it. The expectation was that a new script would default to the latest engine, but the TypeError: AdsApp.getGoogleAdsService is not a function persists even with a freshly created script.

Thank you for your time and assistance.

Best regards,

Google Ads Scripts Forum Advisor

unread,
Aug 20, 2025, 4:03:01 AMAug 20
to adwords...@googlegroups.com
Hi,

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

Based on the provided information, I understand that you are encountering a "TypeError: AdsApp.getGoogleAdsService is not a function" error. This error occurs because getGoogleAdsService is not a method in the AdsApp object. I would recommend you refer to the guide AdsApp to get more information on all the supported methods in the AdsApp object.

Please be informed that the scripts that are created using the third-party applications like Gemini are out of scope for the Google Ads Scripts support team, as our team only provides guidance on the scripts that are implemented using the Google Ads Scripts documentation. So, I would suggest you create a script by following this document. Also, you may check these sample codes.

I hope this helps! Feel free to get back to us if you have any further queries related to the Google Ads Scripts.
 

Thanks,
 
Google Logo Google Ads Scripts Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-08-20 08:02:15Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u4ijp:ref" (ADR-00330445)



Reply all
Reply to author
Forward
0 new messages