简体   繁体   中英

How to properly track link clicks in Google Tag Manager?

I have started to test Google Tag Manager and we are not best friends. On http://www.example.com/examplepage/ I have a simple link like so:

<a href="http://www.example.com/anotherexamplepage/">My text here</a>

How do I trigger that click?

In "Triggers" i have created an "Click" event that targets all elements witch fires on: "click target" -> "contains" -> " http://www.example.com/anotherexamplepage/ ".

Then I have created a tag to Analytics witch fires on "Click" where I have selected the trigger I have created.

What am I doing wrong?

Kind regards Johan Linnarsson

Use "Click URL" variable instead of "Click target" . Documentation: https://support.google.com/tagmanager/answer/6106961?hl=en

Click Element: The HTML element that was clicked. Click Classes: An array of the values found in the element's class attribute. Click ID: The ID attribute of the clicked element. Click Target: The target attribute of the clicked element. Click URL: The HREF attribute of the clicked element, if any. Click Text: The visible text inside the clicked element.

Try using Click Text equals "My text here" instead. In order to use Click Target , you have to have a target attribute for the auto-event element (ie. the element that was clicked). If you had like an ID or something, that would be better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM