Created
April 27, 2011 18:07
-
-
Save ctbarna/944808 to your computer and use it in GitHub Desktop.
Track External Links with Google Analytics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gaParentDiv = ""; // Only change links in this selector including trailing space. | |
var trackingBase = "/ext/"; | |
$(parentDiv+"a[href^=http\\:\\/\\/]:not(a[href*=\\/"+document.domain+"])").click(function () { | |
pageTracker._trackPageview(trackingBase+$(this).attr("href")); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment