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):
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.
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.
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.
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.
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.
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,
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.
![]() |
Google Ads Scripts Team |
[2025-08-20 08:02:15Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u4ijp:ref" (ADR-00330445)