How to trace # link through GTM
Sometimes, we will use # for linking to another section on the same page.
But if we want to trace the click event by GTM. That will be a problem.
Here’s the HTML for the link
<a href="#10">
no.10 player
</a>
And we set up the Just Click trigger with Page Path equals /#10 on GTM.

But the trigger won’t fire. We can open Tag Manager Preview to find out what happened.
The problem is why the Page Path is / and where’s the #10?

Ok, after searching the message on google.
We’ll know that the string in the URL after the hash mark is called Fragment.
So we go to the variable section, and add a User-Defined Variables names URL Fragment.

And now your trigger can set fires on URL Fragment equals 10.


Then everything works fine. Well done, Agent P.