Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does it matter if GTM is capturing a click event as gtm.click rather than gtm.linkClick?

I am looking for some advice on Google Tag Manager click events.

Our client has requested that a certain click should be captured as gtm.linkClick event. However, the element in question is a button that will trigger routing within an Angular Application. This button click is being captured as gtm.click.

My question is, does that matter? Will this provide less information or can I configure GTM tags to grab the same information?

like image 529
Rob Fyffe Avatar asked Nov 21 '25 05:11

Rob Fyffe


1 Answers

In GTM a click-based trigger has two options: if you want it to only listen for clicks on regular links ("Just Links" option) or for clicks on any HTML element on the page ("All Elements" option).

gtm.linkClick event is Click - Just Links trigger type in GTM gtm.click event is Click - All Elements trigger type in GTM

If user is clicking to <a> HTML tag, it's firing gtm.linkClick event, in other case, if user click in other any html tag(buttons,images,span, divs and etc), it will fire gtm.click

One tricky moment.

You might want to track click on complex <div> which contains child elements. gtm.click might fire on children html tags.

For example if you have markup

<div id="parent">text <span>child1</span> and <div>child2</div></div>

And you want to crack clicks on #parent div. In this case, better way to do that is to have trigger condition

Click Element - matches CSS selector - `#parent, #parent *`

It will trigger if click will happen on #parent div or in one of his child

like image 199
Victor Leontyev Avatar answered Nov 23 '25 01:11

Victor Leontyev