tmort / Socialite

Other
1.68k stars 163 forks source link

Google Analytics social tracking #7

Closed alesma closed 12 years ago

alesma commented 12 years ago

Hi David,

thanks for your awesome work! I'm trying to call google analytics function to track tweets and likes.

I have no problem with facebook like thanks to window.fbAsyncInit that is called when all.js is loaded so i can do this wherever I want:

window.fbAsyncInit = function() {
  _ga.trackFacebook();
};

with twitter i should call _ga.trackTwitter after widget.js is loaded, usually i call it with the async js code like this:

!function(d,s,id){
var js, fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id)){
js=d.createElement(s);
js.id=id;
js.src="http://platform.twitter.com/widgets.js";
js.onload=_ga.trackTwitter;
fjs.parentNode.insertBefore(js,fjs);
}
}(document,"script","twitter-wjs");

but i don't know how get the same results when using socialite.js

Can you help me?

Thanks.

influxweb commented 12 years ago

Hi David,

I am actually interested in how to properly get this functioning as well. I have looked over the documentation provided by Google (http://code.google.com/apis/analytics/docs/tracking/gaTrackingSocial.html), however it says the Facebook tracking doesn't work with the iframe option like Socialite uses. Any ideas of a simple way to get this integrated?

Thank you, Matt

dbushell commented 12 years ago

Hi guys, I don't want to code Google Analytics directly into Socialite, but I will look at providing events so that you can hook this sort of thing into it. Thanks for the idea :)

influxweb commented 12 years ago

Hi David,

That would be great. Thanks again for your great development on this. It has really made my life a lot easier.

Cheers, Matt