Last active
June 28, 2019 19:45
-
-
Save PureLandFlying/f8cca4a9c2f0b3936abc72c64cef35b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() { | |
var adGroupIterator = AdsApp.adGroups().withCondition("CampaignStatus = ENABLED").withCondition("AdGroupType IN [SEARCH_STANDARD, SEARCH_DYNAMIC_ADS]").get(); | |
while (adGroupIterator.hasNext()) { | |
var adGroup = adGroupIterator.next(); | |
var gn=adGroup.getName().replace(/[\s|<|>|=]/g,'_'); | |
var cn=adGroup.getCampaign().getName().replace(/[\s|<|>|=]/g,'_'); | |
adGroup.urls().setCustomParameters({adgroup: gn, campaign: cn}); | |
adGroup.urls().setTrackingTemplate("{lpurl}?utm_medium=Search&utm_source=GoogleSearch&utm_campaign={_campaign}&utm_content={_adgroup}&utm_term={keyword}") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment