April 8, 2020
To make the Page Analytics data more accurate, you need to enable Enhanced Link Attribution in Google Analytics, which can be done in Google Analytics tag itself or via Google Tag Manager. Let’s consider both options. Firstly, to make enhanced link attribution work, you will need to enable it in the Google Analytics Admin panel (“Property settings” section):
Then, to set everything up in the Google Analytics tag, modify your code on each page to load the enhanced link attribution plugin (called "linkid").
The following code shows how to load the enhanced link attribution plugin:
ga('create', 'UA-XXXXX-Y', 'auto');
ga('require', 'linkid');
ga('send', 'pageview');
Customization of the plugin is available. Enhanced Link Attribution differentiates between links to the same URL, by checking the parent element ID and you can control how the plugin should look.
This example explains how to customize configuration options when using the Enhanced Link Attribution plugin:
ga('create', 'UA-XXXXX-Y', 'auto');
ga('require', 'linkid', {
'cookieName': '_ela',
'duration': 45,
'levels': 5
});
ga('send', 'pageview');
“Levels” is the most important setting which will tell the plugin the maximum number of DOM levels to check. The default value is “3”.
How to configure Enhanced Link Attribution in Google Tag Manager.
To enable Enhanced Link Attribution in Google Tag Manager, you need to go to your Google Analytics settings variable, select “More settings” and then “Advanced configuration”. Set “Enable Enhanced Link Attribution” to true and that’s it. Please note that if you configure everything in GTM, you still need to have ELA enabled in the Google Analytics Admin Panel.