2

Before setting my website up, I want to be able to setup Google Analytics correctly to track my requirements.

I am looking to be able to track clicks on images and text links that contain the same destination URL, and if there is also a way to integrate or categorize them as free and paid.

The reason I want to to do this is to be able to see which does better: the image vs text.

I know there are options with Google Tag Manger and enhanced link attribution, but I'm not certain which to use, or does one do both...or if there's another way.

1 Answer 1

2

The easiest way would be to give your tags a specific class and data- attributes. Something like:

<a href="url" class="paid-text" data-reftype="Paid Text" data-refname="Text Block Name">Paid Text</a>

Then you would go into Google Tag manager and set up the following:

1) Link Click Listener tag to fire on all pages

2) Event Tracking tag

3) Custom Javascript Macros for each field of you Event Tracking Tag in the following format:

function(){return {{element}}.dataset.name;}

Where .name equals the part right after data- that you used in your link. So in this case it would be reftype and so on.

4) Create a new firing rule that will look for the class you assigned to your link. In this case its "paid-text". Use the following format:

{{event}} equals gtm.linkClick

{{element class}} equals paid-text

You can find a full description of this in a question I asked a while back:

Tracking rotating Ads with Google Tag Manager

1
  • Sorry for the huge delay. But Thank you very much for the quick answer. Commented Aug 9, 2014 at 4:36

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.