-
-
Save eduardocereto/2887567 to your computer and use it in GitHub Desktop.
AddThis and Google Analytics integration
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
<script type="text/javascript"> | |
// standard GA async code | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-XXXXX-X']); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
})(); | |
</script> | |
<script type="text/javascript"> | |
// set the options for addthis | |
var addthis_config = addthis_config || {}; | |
addthis_config.data_track_clickback = true; // or your own options | |
addthis_config.data_ga_tracker = null; // unbind AddThis and GA | |
_gaq.push(function () { | |
// once ga.js is loaded, bind YOUR tracker with addthis, don't let addthis create a new one | |
addthis_config.data_ga_tracker = _gat._getTrackerByName(); | |
addthis_config.data_ga_social = true; | |
}); | |
</script> | |
<!-- where you insert the button , put your pusblisher ID--> | |
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=XXXXXXXXXXXXXXX"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment