A Developers Guide to Conversion (Link Click) Tracking with Google Tag Manger, Google Adwords, and Facebook
Say you’re marketing department comes to and they want to run an ad campaign with Google AdWords and they want to be able to track conversions (how many people visited the site, clicked on a button, submitted a form, etc.).
You could just use Google Adwords to do this, but if you ever want to add additional conversion tracking (say they also want to run a Facebook [FB] ad campaign and track conversions for that) you would need to add
script tags for FB to each page as well. You would then, also need to add special HTML code to track button clicks if you were just using AdWords and FB.
Instead of adding
script tags for multiple tracking services, with Google Tag Manger (GTM) you can consolidate all of your tracking services in one central location and then only add
script tags for GTM. GTM also has automatic event tracking (link click detection, form submission, etc.) so you won’t have to add any special HTML code to detect these actions.
Your page will generally have many tags and you will control when these tags fire with triggers. You control when a trigger is fired by using a variable with conditions that evaluate to true or false at runtime. For example, if you have a button and you want to track when someone clicks that button, you would create a trigger that fires x tag (where x=a FB or AdWords conversion) when the link click variable meets the condition ‘the
href of the link is
How to use GTM to track AdWords and FB click conversions
- Create a new conversion for the link click (Tools > Conversions)
- After creating the conversion you will see an ‘Install your tag’ section and you should ensure that ‘Page load’ is selected for ‘Choose whether to track conversions on a page load or a click’. Note: This seems counterintuitive since we are trying to detect a link click, but since we can control when the conversion is triggered in GTM (using variables wit conditions) we don’t need to use AdWords method of detecting link clicks (adding
onclickto commands to your
- Take note of the ‘Tag for Request a Demo’ as we’ll need the
- Setup GTM for your website (or app)
- Enable the ‘Click URL’ built in variable (Workspace > Variables > Built-in Variables > Configure)
- Create a new Click trigger and give the trigger a descriptive name (We’ll use ‘The most important link click’)
- Configure the trigger to only fire on ‘Some Clicks’
- Choose ‘Click URL’ equals
- Create a new Tag and in the Tag Configuration choose AdWords Conversion Tracking. Add the
google_conversion_labelfor the tag.
- Choose the Trigger you set up in steps 3–5 (‘The most important link click’ our case)
Congrats! You now have link click tracking conversion set up for AdWords. Now let’s do the same for Facebook.
GTM doesn’t have native support for Facebook but luckily Facebook has a wizard that can automatically add Tags to GTM
- Create a Custom Conversion (Hamburger menu > Measure & Report > Custom Conversions)
- Create a Facebook Pixel (Hamburger menu > Assets > Pixels)
- You should then be taken into a wizard the will help you install your Pixel code. Choose ‘Use an Integration or Tag Manager’ and then Google Tag Manager. Then choose ‘Quick Install’.
- Then, on Step 3 of the Fig. 1.1 you will want to add a Tag for the link click.
- Then, go back into GTM and click on the newly created Tag
- In Triggering, remove the Page Load trigger and add ‘The most important link click’ trigger.
Now, whenever someone clicks on a link that has an
https://themostimportantlink.com our AdWords and Facebook conversions will be triggered.
When I first started this project, I thought I would need to do a lot more coding, but GTM’s automatic event tracking made adding additional code unnecessary. At first this was confusing, but after I created a few triggers and tags and used the preview mode to confirm everything was working, I began to understand how simple it is to do conversion tracking using a Tag Manager.