Created
October 18, 2012 15:38
-
-
Save felipelavinz/3912625 to your computer and use it in GitHub Desktop.
Event tracking when using multiple Google Analytics accounts
This file contains hidden or 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
(function($){ | |
$(document).ready(function(){ | |
$('a[href$=".pdf"]').click(function(){ | |
var trackers = _gat._getTrackers(), | |
specific_tracker = trackers[ trackers.length - 1 ], // assuming that the last tracker it's the one where you want to track the events | |
dl_url = $(this).attr('href'), | |
tracked = specific_tracker._trackEvent('Downloads', 'PDF', dl_url); | |
if ( typeof console.log == 'function' ) console.log( specific_tracker._getName(), tracked, dl_url ); | |
}); | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment