Behavior

Enhanced Link Attribution

About enhanced link attribution

You can tag your pages to implement an enhanced link-tracking functionality that lets you:

  • See separate information for multiple links on a page that all have the same destination. For example, if there are two links on the same page that both lead to the Contact Us page, then you see separate click information for each link.

  • See when one page element has multiple destinations. For example, a Search button on your page is likely to lead to multiple destinations.

  • Track buttons, menus, and actions driven by javascript.

Tag your page for enhanced link attribution

You can implement enhanced link attribution in either analytics.js or ga.js.

 

analytics.js

Add the tag to your tracking code, after you create a tracking object, as illustrated by the red text in the example below:

ga('create', 'UA-XXXX-X');
ga('require', 'linkid', 'linkid.js');
ga('send', 'pageview');

 

ga.js

Add the tag to your tracking code, before _trackPageview, as illustrated by the red text in the example below:

var _gaq = _gaq || [];
var pluginUrl =
 '//www.google-analytics.com/plugins/ga/inpage_linkid.js';
_gaq.push(['_require', 'inpage_linkid', pluginUrl]);
_gaq.push(['_setAccount', 'UA-XXXXXX-Y']);
_gaq.push(['_trackPageview']);

 

Enable enhanced link attribution in the reports

After you update your tracking code, you then need to enable enhanced link attribution in your property settings:

  1. Click Admin at the top of any Analytics page.
  2. Navigate to the property for which you want to use enhanced link attribution, and click the Property Settings tab.
  3. In the In-Page Analytics section, select the Use enhanced link attribution option.
  4. Click Apply.

Enhanced link attribution offers more-detailed reports, and disambiguates clicks to the same destination page that come from more than one element on the page. However, the additional detail comes at the cost of some speed in generating the report, so only turn it on if you need it. You can always turn it off again if you no longer need it.

Why you might see a range rather than a fixed number of clicks

Analytics tries to identify exactly which elements on the page users clicked. If an element has a unique ID, then Analytics is able to identify the number of clicks on that element. If an element does not have a unique ID, then Analytics looks up to three levels higher in the DOM structure for a unique ID (i.e., the element's parent's parent). If Analytics is still unable to find a unique ID, then you see a range.

In addition to elements not having unique IDs, there are other reasons why Analytics may not be able to identify whether users clicked elements on the page. For example, in cases where users clicked the back button, refreshed the page, or simply navigated directly to another page on the site, there are no clicks to attribute to page elements, and Analytics displays a range.

Take, for example, these navigations from Page A to Page B:

  • Page A -> Page B, 100 navigations attributed to clicks on Element ID-1
  • Page A -> Page B, 200 navigations attributed to clicks on Element ID-2
  • Page A -> Page B, 50 navigations that can't be attributed to any Element ID

In this case:

  • Element ID-1: 100-150 clicks
  • Element ID-2: 200-250 clicks
  • Elements with no ID: 0-50 clicks