Google Analytics:为链接点击设定事件追踪的方法

Google Analytics:为链接点击设定事件追踪的方法
转载自:http://www.renfei.org/blog/google-analytics-event-tracking-for-links.html

var trackOutboundLink = function(url) {
	var redirectTriggered = false;
	ga('send', 'event', 'outbound', 'click', url, {'hitCallback':
		function() {
			redirectTriggered = true;
			document.location = url;
		}
	});
	setTimeout(function() {
		if (!redirectTriggered) {
			document.location = url;
		}
	}, 1500);
}

Related posts:

Leave a Reply

Your email address will not be published.