A while back, I wrote some posts on tracking some social buttons in Google Analytics, including Facebook likes and LinkedIn shares. I figure it’s about time I complete the round-up. So, next on the list: Twitter buttons.
When you generate a Twitter button for your website, you’re given code that looks something like this:
As was the case with Facebook, Twitter was nice enough to give us a callback function that is executed whenever a Tweet is successfully sent from such a button. In order to add Google Analytics social media tracking to this action, you just need the following code added to the page:
document.title with the name of the page to tweet, in quotes.
Twitter also provides buttons that allow visitors to quickly follow your tweets. The code for such buttons looks like this:
You’ll need the asynchronous code given above to make this button function as well. Again, Twitter’s callback functions let you recognize whenever someone performs a follow action, and you can track the social media engagement accordingly. The following code will do the trick:
This code tracks a social action called ‘Follow’ in the network ‘Twitter’, and sends the Twitter name of the user followed. Please note also that all code on this page uses the Google Analytics asynchronous tracking code. If you’re using the traditional snippet, you’ll need to make modifications.
All of this allows you to gauge the effectiveness and utility of Twitter buttons on your site. Using segmentation, you can see whether people who tweet articles/posts/content are more engaged or likely to purchase than others, or whether certain content gets you more Twitter followers.
So, that’s basically it — use the code above and start measuring the impact of Twitter buttons on your site’s traffic. The results will show up within Google Analytics under Traffic Sources > Social > Social Plugins.