Google Tag Manager Tip: What to do if and gtm.linkClick are not working? | Articles

On some websites, the and gtm.linkClick events are not workining. No matter where you click, those events are never added to the event list. If you want to do some more complex tagging, those events are indispensable.

The events can be blocked from firing due to a number of reasons. Most of the time it’s a conflicting JavaScript library or script. In JavaScript events “bubble” up from the deepest element that was clicked up to the document element. For example, when you click a link, first the click event is fired on the link element, after that the click event is fired on the parent element of that link, for example a paragraph the link element is nested in, and so on. Until it reaches the document element and fires the click event there. GTM is listening for click events on the document level. So whenever another script stops the click event from propagating before it has reached the document’s click listener, GTM will never know this click ever happened.

Luckily there is an easy solution for this: we create a custom HTML tag that creates a GTM event whenever an element or link is clicked on a page.

1. Create a new Custom HTML tag, name it GTM Click Helper.
2. Add the following code to the tag:

<script src="//"></script>


/// load jQuery in no-conflict mode


/// run the following script using our jQuery library

(function($) {

/// dom ready

$(function() {

/// add handlers

$('body').on('click', function(e)




"gtm.elementClasses": $('class'),

"gtm.elementId": $('id'),


"gtm.elementUrl": $('href'),

"event": ""



/// add gtm.linkClick handlers

$(document).on('click', 'a', function(e)



"gtm.element": e.currentTarget,

"gtm.elementClasses": $(e.currentTarget).attr('class'),

"gtm.elementId": $(e.currentTarget).attr('id'),


"gtm.elementUrl": $(e.currentTarget).attr('href'),

"event": "gtm.linkClick"






3. Make the tag fire on All Pages.
4. Preview and/or publish your GTM container.

That’s it! When you click elements and links in your page, the and gtm.linkClick events should fire correctly.

Author: David Peeters



Get in touch

Semetis | Rue de l'Escaut 122, 1080 Brussels - Belgium

Connect with us

Cookie Policy

This website uses cookies that are necessary to its functioning and required to achieve the purposes illustrated in the privacy policy. By accepting this OR scrolling this page OR continuing to browse, you agree to our privacy policy.