Request for a Support in clearing Tracking Template from Adgroup Level using script

43 views
Skip to first unread message

Anshul Jain

unread,
Apr 3, 2021, 2:50:46 AM4/3/21
to Google Ads Scripts Forum
Dear All,

I have  8000+ adgroups where I have been using 

var TrackingTemplate="{lpurl}?utm_source=google&utm_medium={AdGroupName}&utm_campaign={CampaignName}&utm_device={device}&utm_network={network}&utm_keyword={keyword}&utm_matchtype={matchtype}&utm_placement={placement}";  


Now I want to clear all the tracking parameters from the "Paused"  adgroups. and start fresh. I have a very little knowledge on the script (Can make minor changes in the script).

Request to you help me with the script to "clear all the about parameters for the paused campaign"

Thanks in Advance

Anshul





Google Ads Scripts Forum Advisor

unread,
Apr 5, 2021, 3:30:01 AM4/5/21
to adwords...@googlegroups.com
Hi Anshul,

Thanks for reaching out. I am Harry from the Google Ads Script Team. Allow me to assist you on this.

To retrieve entities at the AdGroup level, kindly use a AdGroupSelector and AdGroupIterator. Here's an example on how to get all of your Ad Groups, but since you would like to retrieve paused Ad Groups, you would have to add a withCondition to your Ad Group selector to only retrieve Ad Groups that are paused (Eg withCondition("Status = PAUSED") ). After that, you may remove Ad Group Tracking Templates by using the clearTrackingTemplate() method.

In addition, since you have mentioned that you would have to manage a large number of Ad Groups, I would suggest to keep your entities in a list first rather than managing them in your iterator directly as this may cause unexpected behaviors due to the large number of entities you would like to manage. When you update a list of entities, make sure your code doesn't break the iterator's selector condition as a side effect. This leaves the selector in an indeterminate state and may cause unexpected behavior. Please see the recommended coding approach.

Let me know if you have questions or other concerns.


Thanks,
Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2EpbdT:ref
Reply all
Reply to author
Forward
0 new messages