Skip to content

Instantly share code, notes, and snippets.

@replete
Created April 14, 2012 14:49
Show Gist options
  • Save replete/2384908 to your computer and use it in GitHub Desktop.
Save replete/2384908 to your computer and use it in GitHub Desktop.
Check domain before running domain-specific code, e.g. analytics
if (document.location.hostname.indexOf("mydomain.com") > -1) {
//GA: Event Tracking, for example
$("a[href$=pdf]").click(function () {
var name = $(this).attr("title") || "";
_gaq.push(['_trackEvent', 'PDF', 'Download', name]);
});
//etc
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment