Price extension script

406 views
Skip to first unread message

Andrew Rozynski

unread,
Aug 22, 2022, 10:16:09 AM8/22/22
to Google Ads Scripts Forum
  • Google Ads account ID / CID: 227-678-0025
  • Script name: "Price Extension Script HC"
Hi, I tried to implement the below script for our client but it seems that the script is not working.


I tried without "new script experience" and I get the below message
"Thanks for using this custom script by Tibbe van Asten. Winning!"
but there is no new extension when I check...

If I try with "new script experience" I get an error message seen in the image attached.

Just wondering if anyone here could make it work.



2022-08-22 08_58_24-dyson_ch_ch_hc_b2c_google - Google Ads.png

Google Ads Scripts Forum

unread,
Aug 22, 2022, 10:34:40 PM8/22/22
to Google Ads Scripts Forum
Reposting the last inquiry (https://groups.google.com/g/adwords-scripts/c/cwtA9eSPSls) from the forum as it wasn't routed to our support queue.

Regards,
Yam
Google Ads Scripts Team

Google Ads Scripts Forum

unread,
Aug 23, 2022, 6:02:27 AM8/23/22
to Google Ads Scripts Forum
Reposting the last inquiry (https://groups.google.com/g/adwords-scripts/c/cwtA9eSPSls) from the forum as it wasn't routed to our support queue.

Regards,
Yasmin
Google Ads Scripts Team

Google Ads Scripts Forum Advisor

unread,
Aug 24, 2022, 2:49:51 AM8/24/22
to adwords...@googlegroups.com

Hi,

 

Thank you for reaching out to us. This is Yasmin from the Google Ads Scripts team.

 

I believe you can't get the approval policy status directly using the AdsApp.extensions method. What you may do instead is to utilize search instead, then use the ad_group_ad.policy_summary.approval_status field.

 

Let us know how it goes.

 

Regards,

 

Google Logo
Yasmin Gabrielle
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2dmdSA:ref

Andrew Rozynski

unread,
Aug 29, 2022, 10:36:15 AM8/29/22
to Google Ads Scripts Forum
Hi Yasmin,

Could you please tell me what exactly I have to change in the script : ) What line and replace with what?

Regards,
Andrew

Andrew Rozynski

unread,
Sep 2, 2022, 9:51:13 AM9/2/22
to Google Ads Scripts Forum
Hey guys, any update on this? : ) 

Google Ads Scripts Forum Advisor

unread,
Sep 5, 2022, 12:50:42 AM9/5/22
to adwords...@googlegroups.com

Hello Andrew,

I’m James from the Google Ads scripts support team as well. Thank you for your patience on this.

Kindly disregard the suggestion provided by my colleague in her previous email. Instead, what you need to do is to migrate the `PolicyApprovalStatus` field used within your price iterator which you can see under line number 54 in order to resolve the error that you’re experiencing, then replace it with the “asset.policy_summary.approval_status” field. See sample implementation below.

var priceIterator = AdsApp
    .extensions()
    .prices()
    .withCondition("asset.policy_summary.approval_status IN ['APPROVED','APPROVED_LIMITED']")
    .get();

Let me know how it goes on your end.

Regards,

Google Logo
James Howell
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2dmdSA:ref

Andrew Rozynski

unread,
Sep 6, 2022, 2:35:42 AM9/6/22
to Google Ads Scripts Forum
Hi James,

Thank you for the help, but I got an error seen below and in the image.

"Field name asset.policy_summary.approval_status is invalid. Please check your spelling and casing. (file Code.gs, line 50)"
2022-09-05 10_08_05-fast access - Excel.png

Andrew Rozynski

unread,
Sep 12, 2022, 1:00:51 AM9/12/22
to Google Ads Scripts Forum
Hi all, sorry but is there any update on this? : )

Google Ads Scripts Forum Advisor

unread,
Sep 12, 2022, 1:21:23 PM9/12/22
to adwords...@googlegroups.com
Hi Andrew,

My colleague, James, responded earlier. If you did not see his response, please see below:

I’m James from the Google Ads scripts support team as well. Thank you for your patience on this.

Kindly disregard the suggestion provided by my colleague in her previous email. Instead, what you need to do is to migrate the `PolicyApprovalStatus` field used within your price iterator which you can see under line number 54 in order to resolve the error that you’re experiencing, then replace it with the “asset.policy_summary.approval_status” field. See sample implementation below.

var priceIterator = AdsApp
    .extensions()
    .prices()
    .withCondition("asset.policy_summary.approval_status IN ['APPROVED','APPROVED_LIMITED']")
    .get();

Let me know how it goes on your end.

Regards,

Google Logo
Matt
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2dmdSA:ref

Adsscripts Com

unread,
Sep 15, 2022, 5:20:11 AM9/15/22
to Google Ads Scripts Forum
Hi Andrew,

I've made some changes to the script to get it working again. The solution provided works fine!

But then I ran into another issue: adding enddate or schedules to an extension is not possible anymore. How can I pause/remove a price extension using scripts?

Kind regards,
Tibbe van Asten

Op maandag 12 september 2022 om 19:21:23 UTC+2 schreef adsscripts:

Google Ads Scripts Forum Advisor

unread,
Sep 15, 2022, 1:30:50 PM9/15/22
to adwords...@googlegroups.com
Hello,

Please see the available methods for price extensions updates, here. There is no pause/remove method supported, but you can set an end date.

Adsscripts Com

unread,
Sep 16, 2022, 7:26:23 AM9/16/22
to Google Ads Scripts Forum
Unfortunately, the script reports an issue with end date:
Price extensions no longer support end dates so this method ('setEndDate') no longer does anything.
Price extensions no longer support schedules so this method ('setSchedules') no longer does anything.


Are there any other solutions?

Op donderdag 15 september 2022 om 19:30:50 UTC+2 schreef adsscripts:

Jan Hahlbrock

unread,
Sep 22, 2022, 4:11:52 AM9/22/22
to Google Ads Scripts Forum
Also wondering if there are any other solutions. The script was very useful in the past and it would be great to have it back.

Kind Regards,
Jan

Google Ads Scripts Forum Advisor

unread,
Sep 22, 2022, 10:16:05 AM9/22/22
to adwords...@googlegroups.com
Hello,

Thanks for your feedback. I have submitted an internal feature request for changing price extension status. Please see the Ads scripts blog for relevant updates.

Martin Manchev

unread,
Sep 27, 2022, 10:02:50 AM9/27/22
to Google Ads Scripts Forum
Hello,

I have a very similar question to the one being discussed in this thread.

I'm trying to get all the call extensions that are currently limited/disapproved by any policy.
I may use the code below, but I have some questions:

// Works Fine
var disapprovedExtensions = AdsApp
    .extensions()
    .phoneNumbers()
    .withCondition('asset.policy_summary.approval_status != APPROVED')
    .get();

1) Why if I try to use .withCondition('asset.policy_summary.approval_status IN (DISAPPROVED, APPROVED_LIMITED)') I get an error:
"Exception: Call to GoogleAdsService.Search failed: The enum value is not permitted".


2) I've used the code below for years and I prefer to stick to the same logic, but I can't find a way to generate a report that contains the approval status field.

//Old Code
var report = AdsApp.report(
    'SELECT ValidationDetails, FeedId, Status ' +
    'FROM   PLACEHOLDER_FEED_ITEM_REPORT ' +
    'WHERE PlaceholderType = 2 ');

I need the new field name, equivalent to the  ValidationDetails, so I can put it in the  SELECT clause. Unfortunately, I couldn't find it anywhere
//New Code
 var report = AdsApp.report(
    'SELECT extension_feed_item.status, extension_feed_item.id ' +
    'FROM   extension_feed_item ' +
    'WHERE  extension_feed_item.extension_type = CALL')


Any help would be highly appreciated!

Regards :)

Martijn Kraan

unread,
Sep 27, 2022, 4:47:13 PM9/27/22
to Google Ads Scripts Forum
Hi Martin,

Disclaimer: I'm not from the official Google Ads Scripts team. I've thrown your query in the migration tool and the result was:

ValidationDetails_migrated.png

Which is a completely different report ("FROM feed_item instead" of "FROM extension_feed_item").
The "ValidationDetails" field would be "feed_item.policy_infos".

Maybe this helps?!
Greetings, Martijn

Martin Manchev

unread,
Sep 28, 2022, 6:24:53 AM9/28/22
to Google Ads Scripts Forum
Thank you so much, Martijn! 

This seems like a working solution. 
When I run this query I get the following result:
[{reviewStatus=REVIEWED, approvalStatus=DISAPPROVED, validationStatus=VALID, policyTopicEntries=[{type=PROHIBITED, topic=UNVERIFIED_PHONE_NUMBER}], placeholderTypeEnum=CALL, feedMappingResourceName=customers/6871795952/feedMappings/390145980~308566047}]

How can I access only the approvalStatus in this case? 

Martijn Kraan

unread,
Sep 28, 2022, 11:01:36 AM9/28/22
to Google Ads Scripts Forum
Hi Martin,

I'm not sure if I understand the question correctly, but maybe this sample code can help (tested it on callouts since I don't have any call extensions active)?

---------

function main() {
 
  let query = "SELECT feed_item.feed, feed_item.policy_infos, feed_item.status, segments.placeholder_type FROM feed_item WHERE segments.placeholder_type = 'CALLOUT'";
  let rows = AdsApp.search(query);
 
  while (rows.hasNext()) {
    let row = rows.next();
    let extension = row.feed_item;
    console.log(row.feedItem.policyInfos)
  }
}


---------

Google Ads Scripts Forum Advisor

unread,
Sep 29, 2022, 2:31:44 AM9/29/22
to adwords...@googlegroups.com

Hello All,

 

Yasmin here from the Google Ads scripts team.

 

@Martijn - Thank you for your insights and for helping another community member out. We truly appreciate the assistance you've been providing.

 

@Martin - You could try basing from Martijn's advice as well as the code they had provided for your second concern. Do let us know if you would encounter an error when generating your script.

 

That said, it appears that your syntax for your first concern is missing single quotes (') per enum. Would you be able to try .withCondition("asset.policy_summary.approval_status IN ('DISAPPROVED', 'APPROVED_LIMITED')") and see if it works for you?

 

Regards,

 

 

Google Logo
Yasmin Gabrielle
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2dmdSA:ref

Martin Manchev

unread,
Sep 29, 2022, 3:02:37 AM9/29/22
to Google Ads Scripts Forum
Thank you,  Martijn!

I had pretty much the same code, but I get results that look like this:

[ { reviewStatus: 'REVIEWED', approvalStatus: 'DISAPPROVED', policyTopicEntries: [ [Object] ], validationStatus: 'VALID', placeholderTypeEnum: 'CALL', feedMappingResourceName: 'customers/6871795952/feedMappings/390145980~308566047' } ]


I'm actually trying to print out only the approvalStatus property

something like:
console.log(row.feedItem.policyInfos.approvalStatus) // It's not working and I'm looking for the right syntax.



Martijn Kraan

unread,
Sep 29, 2022, 3:35:17 AM9/29/22
to Google Ads Scripts Forum
Hi Martin,

Here is the right syntax ;)

console.log(row.feedItem.policyInfos[0].approvalStatus)

Furthermore, fur the purpose of your script you can try to (pre)filter disapproved extension by adding a "WHERE" clause to your query. See the example code below (this is query in pretty print just for readability). 

SELECT
  feed_item.feed,
  feed_item.policy_infos,
  feed_item.status,
  segments.placeholder_type,
  ad_group_ad.policy_summary.approval_status
FROM feed_item
WHERE
  segments.placeholder_type = 'CALLOUT'
  AND ad_group_ad.policy_summary.approval_status IN ('APPROVED', 'APPROVED_LIMITED') 

Martin Manchev

unread,
Sep 29, 2022, 3:46:57 AM9/29/22
to Google Ads Scripts Forum
Thank you  Yasmin!

While testing the provided solutions I ran into an interesting situation:
I have an account with only 1 call extension in it. The GA interface shows it as Eligible.

But if I use scripts to check it, I get 2 different statuses:

I can access it through:
let callExtension = AdsApp
  .extensions()
  .phoneNumbers()
  .withCondition('asset.policy_summary.approval_status = "APPROVED"')
  .get();

But also, if I use:
 let query = "SELECT feed_item.policy_infos, feed_item.feed, feed_item.status, segments.placeholder_type, feed_item.resource_name, feed_item.attribute_values " +
      "FROM feed_item " +
      "WHERE segments.placeholder_type = 'CALL'"; 

I get: approvalStatus: 'DISAPPROVED'


If you like I can share the ClientID so you can further check it.

Martin Manchev

unread,
Sep 29, 2022, 4:35:01 AM9/29/22
to Google Ads Scripts Forum
Great!

Thank you once again for all the help :))

Martin Manchev

unread,
Sep 29, 2022, 6:05:26 AM9/29/22
to Google Ads Scripts Forum
Capture.JPG
Reply all
Reply to author
Forward
0 new messages