From a8b3dd6eb0caef5bf780d0c0d499258381e6ce27 Sat, 6 Oct 2012 00:59:53 +0200 From: hass Date: Sat, 6 Oct 2012 00:59:38 +0200 Subject: [PATCH] #1425358: Track overlays diff --git a/googleanalytics.js b/googleanalytics.js index 629ffea..5e97045 100644 --- a/googleanalytics.js +++ b/googleanalytics.js @@ -26,9 +26,13 @@ var isCrossDomain = new RegExp("^(https?|ftp|news|nntp|telnet|irc|ssh|sftp|webcal):\/\/.*(" + RegExp.escapeDomains(ga.trackCrossDomains) + ")", "i"); // Is the clicked URL internal? - if (isInternal.test(this.href)) { + if (isInternal.test(this.href) || $(this).is("a[href^=javascript:],area[href^=javascript:],a[href^=#],area[href^=#]")) { + // Track overlays. + if ($(this).is('.colorbox, .highslide-full-expand')) { + _gaq.push(["_trackEvent", "Overlays", "Open", $(this).attr("title")); + } // Is download tracking activated and the file extension configured for download tracking? - if (ga.trackDownload && isDownload.test(this.href)) { + else if (ga.trackDownload && isDownload.test(this.href)) { // Download link clicked. var extension = isDownload.exec(this.href); _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]);