Analytics
Enhanced Link Attribution

Enhanced Linking Set-Up + TagManagerTab name

http://lastclick.city/enhanced-link-attribution.html
April 8, 2020

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.

Google Analytics does not provide its users with heatmaps, but it does enable a site visitor’s behavior to be analyzed using Page analytics plugin for Google Chrome. Page Analytics is not a heatmap, but it shows the clicks distribution between different links on the analyzed page. When installed and launched, Page Analytics plugin shows the following data: 

 

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”.

Enhanced link attribution improves click reports by automatically differentiating between multiple link clicks that have the same URL on a given page.

To use enhanced link attribution:

  1. Enable enhanced link attribution in the Admin UI of your Google Analytics account.
  2. Update your config command on each page to add the 'link_attribution': true parameter.

For example:

// Enable enhanced link attribution
gtag('config', 'GA_MEASUREMENT_ID', {
  'link_attribution': true
});

Enhanced link attribution uses the element IDs of a link or a parent element and a cookie to differentiate between links to the same URL. You can customize how far up the DOM the plug-in will look for an element ID, as well as the behavior of this cookie, by providing configuration options when loading the plug-in.

Here are the available options and their defaults:

Option Data type Default Description
cookie_name string _gali The name of the cookie
cookie_expires number 30 The maximum duration (in seconds) the cookie should be saved for
levels number 3 The maximum number of levels in the DOM to look to find an existing ID. For example, the following links do not contain ID attributes, but the <ul> element (two levels up) does:

<ul id="sidebar">
  <li><a href="/">Home</a></li>
  <li><a href="/about">About</a></li>
  <li><a href="/contact">Contact Us</a></li>
</ul>

If the levels option were set to 1, the “sidebar” ID would not be found and the link would remain anonymous.

For example, the following illustrates how code might look with every possible option customized:

// Turn on enhanced link attribution with every option customized
gtag('config', 'GA_MEASUREMENT_ID', {
  'link_attribution': {
    'cookie_name': '_gaela',
    'cookie_expires': 60,
    'levels': 2
  }
});

Scroll to Top