Adwords Tracking Template – {CampaignName} & {AdGroupName} Parameters

Many of my colleagues had struggled while tagging the urls with the value track parameters, as they had to manually tag ‘CampaignName’ or ‘AdgroupName’ at campaign/adgroup level.

It is also time consuming job, if you have like 1000s of campaigns and 10,000s of adgroups. This script will tag those 10,000 adgroups in a few seconds.

I guess most of the people who use tracking template do track ‘CampaignName’ or ‘AdGroupName’.

How To Use ?

Step 1:

  •  Enter the Tracking Template in the similar format as you would enter in adwords tracking template. Include atleast one of {CampaignName} or {AdGroupName} in the tracking template.
  • For Ex: “{lpurl}?utm_source=google&utm_medium=cpc&utm_adgroup={AdGroupName}&utm_campaign={CampaignName}&d={device}“.

Step 2:

  • There are two filters ‘Adgroup name contains’ and ‘Campaign name contains’.
  • If both are entered, it will ‘and’ these conditions.
  • The tracking template will only be added to the campaign/adgroup ,as per the filters.
  • If you want all campaigns or all adgroups to be included, then just leave it blank.
  • Ex: For all campaigns : _CAMPAIGN_CONTAINS=””;       For all adgroups : _ADGROUP_CONTAINS=””

Step 3:

  • Preview the script.
  • If the url template has been entered properly, you can see the expected output in ‘Changes’.
  • If error is encountered, check logs.


Use Case:

I want to add tracking template to all my campaign names containing ‘products’ as a word.

Step 1:

  • I have pasted my tracking template with {CampaignName} and {AdGroupName} as parameters.

So, I have pasted my tracking template as shown, Now i can preview the script:

Step 2:

  • I can now preview the script & check the parameters applied.
  • I can see that the adgroup name is appended correctly and also its respective campaign name.
  • Also, only the campaigns with “Product” in their campaign name are tagged.
  • I can now run the script.

I hope this solves much of the manual work needed for tagging the urls.

Ritwik is Web Analyst & Growth Hacking Consultant. He loves to write technical & easy to understand blogs for Marketers & Entrepreneurs. Focused on Google Analytics, Tag Management, GScripts & more. Google Certified Professional. A Firm Believer in Teaching -> Learning -> Growing. :)