I took a little time to browse through the AddThis documentation to see if there was any feature I was missing, and it turns out there was something that I had just been wondering about: adding in Google Analytics code to the end of the URL when someone uses AddThis to share a page on your site.
There's documentation on the AddThis site for adding URL parameters, but here's how I modified it to incorporate the Analytics code. In the AddThis code where you call javascript that powers the widget (s7.addthis.com/js/250/addthis_widget.js), add this in:
<script type="text/javascript">
var addthis_share =
{ url_transforms :
{ add: {
utm_campaign: 'AddThis',
utm_source: '{{code}}',
utm_medium: 'share' } } }
<script>
The {{code}} will add in the service that was used to share (ie "delicious", "googlereader", etc) in a single word and in all lowercase letters.
You're just adding in the standard Google Analytics variables in place of the "name" and "favorite number" in the example. Of course, you could add in whatever parameters and values you want, but this works really well for GA, meaning you can now track traffic that comes from links shared through AddThis and create a custom segment for that campaign, meaning you can track just how far those AddThis links are reaching.
It should also be noted that you can put all AddThis javascript in the head so that it doesn't have to load more than once. See the "Optimize AddThis Script" secition at the bottom of this page.
Comments
Post a Comment