Sunday, 24 May 2020

Tracking clicks external links across a website (exit tracking)

External links are links to other websites from your website.

Tracking clicks on all external links is known as exit tracking or outbound tracking.

Through exit tracking, you can measure the volume of traffic your website is sending out, to other websites. This type of tracking is especially useful if you run an affiliate website.

Follow the steps below to track clicks on all external links on your website via Google Tag Manager:

Step-1: Create a new trigger with following similar configuration:
Trigger Name: Check for clicks on External links
Trigger Type: Click – Just Links 
Check Validation 
1. Enable this trigger when all of these conditions are true: Page URL matches Regex .*2. This trigger fires on: Some Link Clicks3. Fire this trigger when an Event occurs and all of these conditions are true: Click URL does not contain <<yourdomain.com>>
Note(1): replace ‘yourdomain.com’ by your website name.
Note(2): ‘Click URL’ is a built-in variable in GTM, which returns the ‘URL’ of the clicked link.
Note(3): The ‘Fire this trigger’ condition makes sure, that this trigger does not fire for clicks on the links, which are internal i.e. the links that contain your domain name.

Step-2: Create a new tag with the following configuration which send clicks on external links to Google Analytics:
Tag Name: Send Clicks on external links to Google Analytics
Tag Type: Universal Analytics
Track Type: Event
Category: Traffic to Other Websites
Action: {{Click URL}}
Label: {{Page Path}}
Non-Interaction Hit: True
Firing Triggers: Check for clicks on External links
Note(1): {{Click URL}} is a built-in variable in GTM which returns the URL of the link clicked. You can select this variable from the dropdown menu.
Note(2): {{Page Path}} is a built-in variable in GTM which returns the URL of a web page.

Step-3: Preview your container to make sure that the new tag is firing.

Step-4: If everything is working as intended then publish the new version of your container.