Google Tag Manager (GTM) lets you track website interactions without writing code for each one. One useful option is the link-click trigger, which fires tags when people click specified links. It can track linked buttons, outbound links, telephone links (tel:) and more.
Steps to set up a link-click trigger in GTM
Step 1: Enable click variables in GTM
Before creating the trigger, enable the required variables:
- Sign in to Google Tag Manager and select your container.
- Open the menu "Variables".
- Under "Built-in Variables", click "Configure".
- Scroll to the category "Clicks" and enable the following variables:
- Click Element
- Click Classes
- Click ID
- Click Text
- Click URL
Step 2: Create a link-click trigger
- Open the menu "Triggers" and click "New".
- Click the trigger configuration box and select "Click – Just Links".
- Choose whether the trigger should fire on "All Link Clicks" (all links) or "Some Link Clicks" (selected links only).
- If you selected "Some Link Clicks", add conditions such as:
- Click URL contains
tel:to track telephone-link clicks. - Click URL contains
mailto:to track email-link clicks. - Click URL does not contain
yourwebsite.comto track outbound links.
- Click URL contains
Step 3: Create a tracking tag, such as Google Analytics or Facebook Pixel
- Open the menu "Tags" and click "New".
- Choose the tag type, for example:
- Google Analytics: GA4 Event to send a click event to GA4.
- Facebook Pixel – Click Event to track clicks with Facebook Pixel.
- Under Triggering, select the trigger you created in the previous step.
- Click "Save".
Step 4: Test and publish
- Click "Preview" to enter debug mode.
- Click links on your website and check that the trigger fires correctly in GTM Preview.
- If everything works correctly, click "Submit" and then "Publish" to publish the changes.
Tip: You can add Tag Assistant for Google Chrome to check tag activity in real time.
Your trigger is now active, allowing you to monitor and analyse website link clicks.
