function main() {
let report = AdsApp.report(
"SELECT " +
"account_budget.id, account_budget.name, account_budget.amount_served_micros, account_budget.adjusted_spending_limit_micros, account_budget.adjusted_spending_limit_type " +
"FROM account_budget ");
let rows = report.rows();
while (rows.hasNext()) {
let row = rows.next();
let id = row["account_budget.id"];
let amount_served_micros = row["account_budget.amount_served_micros"]
console.log("Account budge id:" + id + "Amount served micros : " + amount_served_micros);
}
}
function main() {
let report = AdsApp.report(
"SELECT " +
"metrics.search_impression_share " +
"FROM customer ");
let rows = report.rows();
while (rows.hasNext()) {
let row = rows.next();
let totalImpressionShare = parseFloat(row["metrics.search_impression_share"]);
console.log("Total impression share :" + totalImpressionShare);
}
}
![]() |
Google Ads Scripts Team |
[2025-11-19 14:41:06Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01vTtI7:ref" (ADR-00340601)
Hi ,
Thank you so much for your previous assistance. I have tried the method you suggested for retrieving the Total Impression Share, and it is working perfectly for the account level.
However, I realized that querying the customer resource does not allow me to filter by specific campaign attributes.
Could you please advise if it is possible to retrieve the aggregated Total Impression Share for specific subsets of campaigns? Specifically, I am looking to get this metric for:
Performance Max (PMax) campaigns only.
Campaigns containing specific text in their name (e.g., all campaigns with "dtc" in the title).
Is there a way to achieve this via the scripts ?
I really appreciate your time and help with this.
Best regards,
Yixuan Yang
Hi Yixuan,
I would like to inform you that there is no such metric available to retrieve the aggregated total impression share. However, you can retrieve the top impression share, search impression share of a campaign. I would recommend that you use the below code for the same.
function main() {
let report = AdsApp.report(“SELECT metrics.search_impression_share, metrics.search_top_impression_share FROM campaign WHERE campaign.advertising_channel_type = 'PERFORMANCE_MAX' AND campaign.name LIKE 'dtc'”);
let rows = report.rows();
while (rows.hasNext()) {
let row = rows.next();
let search_impression_share = row["metrics.search_impression_share"];
let search_top_impressions = row["metrics.search_top_impression_share"]
console.log("search impression share:" + search_impression_share + "search top impression share : " + metrics.search_top_impression_share);
}
}
Additionally, you can utilize the Google Ads Query Builder and Query Validator to build and validate the queries for retrieving the data from the Google Ads API.![]() |
Google Ads Scripts Team |
[2025-11-20 08:21:08Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01vTtI7:ref" (ADR-00340601)
--
-- 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 the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scrip...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/adwords-scripts/3cd0eda7-5313-4b04-a3cf-0c8a17b41b03n%40googlegroups.com.