Jeremy Collins
Jeremy Collins

Reputation: 25

How to customize enhanced link attribution for Google Analytics in Google Tag Manager

I'm installing Google Analytics on a website using Google Tag Manager and I want to enable Enhanced Link Attribution.

I've enabled Enhanced Link Attribution in my Google Analytics Property settings and I enabled link tracking on my Google Analytics Settings Variable in Tag Manager. As the documentation states, you can customize the maximum number of levels in the DOM to look for existing IDs, but I can't find an option to change this anywhere in Google Tag Manager.

This is the sample code provided in the documentation link above. The only way I've found to get this working is by uninstalling Google Analytics from Tag Manager and manually installing the tracking code with the modifications to every page of my website.

ga('create', 'UA-XXXXX-Y', 'auto');
ga('require', 'linkid', {
  'cookieName': '_ela',
  'duration': 45,
  'levels': 5
});
ga('send', 'pageview');

Upvotes: 2

Views: 222

Answers (1)

Matus
Matus

Reputation: 1418

In your Google Analytics tag tick "Enable overriding settings in this tag", then click on "More Settings" -> "Fields To Set" and finally "Add Field"

When you click on field name "linkid" should be in the drop-down already, select it and set the value to the object you have in your example. I hope this will work for you.

Upvotes: 0

Related Questions