tkwitten
tkwitten

Reputation: 113

Fire Google Tag Manager GTM Tags on Angular Clicks

My development team has created a single page website with many links like this:

<a href="javascript:" ng-click="setTab('geography');">Geography</a>

and

<a href="javascript:" ng-click="setTab('demography');">Demographics</a>

How can I create Google Tag Manager tags which can differentiate these as separate events since they have the same href as "javascript:"? Is there a way to make the event name based off of the anchor text?

Thanks!

Upvotes: 0

Views: 928

Answers (1)

nyuen
nyuen

Reputation: 8907

In GTM, you can try to utilise the {{Click Text}} variable which, according to GA documentation, is

Click Text: The visible text inside the clicked element.

You would just need to make sure that the anchor element is your clicked element, and the text would follow from that.

Upvotes: 2

Related Questions