Analytics - Outbound Link Tracking with Google Analytics

> Marketing > (Web|Mobile|App) - Analytics (Clickstreams)

1 - About

2 - Steps

2.1 - Snippet

Based on the Capture outbound links documentation, this site capture all external link created with a anchor with this snippet.

outbound.js
jQuery(function () {
	jQuery('a.urlextern, a.interwiki').click(function (e) { // urlextern and interwiki are classes set for outbound link that we want to track
		var url = this.href;
		var hitCallback = function(){document.location = url;};
		if(ga && ga.loaded){
			e.preventDefault();
			ga('send', 'event', 'outbound', 'click', url, {
				'transport': 'beacon',
				'hitCallback': hitCallback
			});
		}
	});
});
Advertising

2.2 - Report

In google analytics, you can see them in the behavior section.

Example with the outbound links to amazon