Tracking clicks on your website is very easy to do. What's better is that it can be done with no releases and little to no development. It can also be done entirely with free tools, (assuming you are OK with a Google toolset).
So let's build our click tracking with GTM (Google Tag Manager) and GA (Google Analytics). The is a very standard setup in a publishing, marketing, or similar site.
We'll assume that at this point you have setup free Google Analytics and Google Tag Manager accounts. To see all this in action, via the browser console, you can check out a page like this product recall site which is a simple project that took just a few hours to setup. Much larger projects can use this setup as well but might have a more sophisticated handling of events or might analyze them via Big Query as opposed to Google Analytics directly.
In GA you'll want to setup a new site, just make sure that in the early stages, in the Advanced field, you pick GA Universal, instead of the new GA4 option. It's possible to change this later on, but it's easy to do it early.
Now, in GTM you'll want to do the following:
Add a new tag. Name it. Click Tag Configuration and then "Google Analytics: Universal Analytics".
Setup the tag as follows:
- Track Type = Event
- Category: Choose a category name. Something like “Affiliate Click” maybe.
- Action:
{{Page Path}}
will send up the page URL of the link, not the destination - Label:
{{Click URL}}
will send up the URL the link goes to. If this option is missing just look for it in the "Built-ins" options Value: - Google Analytics Setting: Select "Enable overriding settings in this tag" and paste in your Google Analytics Tracking ID ("UA-xxxxxxxxxx-xx").
In "More Setting" you'll want to add in any GA Custom Dimensions you'll want alongside this event. Totally optional, but most people use this.
Now, go to the Trigger. Defining this will tell the tag to do its job.
Go to the Trigger page and then hit the "+" and pick “Just Links” by clicking the "Trigger Configuration" box.
At the "This Trigger Fires On" section select “Some Link Clicks”.
Now define your link type. A popular type would be Amazon affiliate links which could be defined as:
“Click URL” “contains” “amzn.to”
Your link might look like "contains /checkout/" or something similar, but it'll vary based on your site.
Save the trigger, save the tag, and then publish the container. You'll want to make sure you already have Google Analytics working on your site, which can be done by putting GA direct on the page, direct in your CMS, or loading it via GTM.
The end result will be Google Analytics events which you can find in the GA UI in Behavior > Events > Top events. But you can also see these in Custom Reports.
And you're all set!
There are many good GTM resources online that can aid you with your growth!
Top comments (0)