: How can I use Google Analytics to track clicks on images and text? Before setting my website up, I want to be able to setup Google Analytics correctly to track my requirements. I am looking
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.
More posts by @Becky754
1 Comments
Sorted by latest first Latest Oldest Best
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
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.