In Google Tag Manager, I'd like to track with an event label in Google Analytics the clicked links href attribute.

On our front page there is a main Call-To-Action section that actually has 3 links. I'd like to track each one.

1) The base Google Universal Analytics (GAUA) tag already exists on all pages.

2) I created a new GAUA tag with the same tracking ID as the base tag.

3) I have specified the following:

  • Track type: event
  • Category: Some Category
  • Action: Some Action
  • Label: Href attribute

Within the event setup, when I select "New Macro" there is an option for DOM, which I thought sounded right but it requires the elements ID. On this site those links do not have an ID attribute.

I tried simply using the CSS selector for the element: a.button.blue-button and then, under Attribute Name I wrote "href".

But it's not working. This was for the label of the event.

How would I create a macro to record the clicked links href attribute?


2 Answers 2


Google Tag Manager does not automatically listen to clicks. You need to tell it to do that by triggering an "Event Listener" type tag.

Then you can create a rule based on the event 'gtm.linkClick' and get the href using the 'element url' predefined macro.


You should open a Tag and defined it as "Event" You can put whatever you want in the category/action/label. I recommend : Category = Page url Action = Click Url Label = Element text

Now you need to create a trigger that will fire every time somebody click on your call to action. I suggest you choose a trigger - "Click on links" choose :"some links" and define that ONLY when clickURL equale the link you want to track.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.