Track in-page anchor links with Google Tag Manager

  • 22 February 2021
  • 1 reply
  • 59 views

Dear Unbounce Community,

I hope you are all doing good during these crazy times.

I am currently working on a task regarding in-page anchor link tracking - and I am unfortunately blocked.

The Goal:
I want to track in-page anchor links and push the tracking information to the Google Tag Manager (GTM) data layer, so I can use it as information for further tracking in Google Analytics (GA).

So far I have tried:
I read through various documentation like https://mediacause.com/track-anchor-tags-google-analytics-2/ which talks about directly modifying the GA code. I believe that this does not work 100% for me, since the GA code is not integrated via the script manager in my Unbounce pages. The GA code is fired via GTM and therefore i need the anchor link tracking information in GTM, to base the triggers on that.

Until know, I could not make this work. Is there anybody who can help me with that/ had a similar problem?

Your help is much appreciated 🥰

PS: If you ask yourself why I do not integrate GA via the script manager → in Europe you have to give a cookie consent before the GA tracking code is legally allowed to be executed. Therefore, we manage all our tracking code snippets via GTM which contains in its data layer the information about the cookie consent given by each user.

PPS: The page i want the tracking to be happening is https://lp.trisor.de/berlin/


1 reply

Hi @julia.altitude

I suggest adding an analytics event for those buttons with a click/element trigger. Be sure to allow all the variables needed for all the elements in GTM. You can set the trigger to only show for some clicks and in that field just enter the “/#lp-pom-block-number

Reply