Created
May 27, 2014 14:58
-
-
Save ortense/ac4b37f4485ba59b5f9c to your computer and use it in GitHub Desktop.
Google Analytics Events for Twitter plugin interactions
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
(function(){ | |
/** | |
* Twitter interaction | |
* @see https://dev.twitter.com/docs/tfw/events | |
*/ | |
var category = 'social', | |
action = 'twitter'; | |
if(twttr && twttr.events && twttr.events.bind){ | |
twttr.events.bind('tweet', function (event) { | |
var label = 'tweet'; | |
ga('send', 'event', category, action, label); | |
}); | |
twttr.events.bind('click', function (event) { | |
var label = 'click'; | |
ga('send', 'event', category, action, label); | |
}); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment