[How To] Track Tweets & Likes through Google Analytics
Google Analytics (GA) is a free service offered by Google that generates detailed statistics about the visitors to a website. Its hugely popular tool which is used 57% of the 10,000 most popular websites on the currently, the list includes Twitter,myspace etc. GA tracks visitors & provides you useful information such as
Traffic source: If it was direct traffic, Purchased traffic via Ads or some other source
Information about Visitor: Their IP Address, country, Browser,time spend on site & lots of other information that could help you understand your visitors
And lots of other such useful bits of information.
What GA could not track until recently was social engagement, if someone click Like button,tweets or shared your site on social network. How do you track it? by default that social media traffic would be shown as DIRECT traffic which is not what you want. But good news is Google analytics now support this and they are calling this
the syntax is as follows:
_trackSocial(network, socialAction, opt_target, opt_pagePath)
1. **Network**: Name of the social network ( facebook, twitter, etc) 2. **SocialAction**: Type of action (like, tweet, send,) 3. **opt_target**: Subject of the action being taken. Optional, defaults to the URL being shared (document.location.href). Can be manually set to anything: a different URL (if they’re sharing content that “points” to another URL), an entity (e.g, product name, article name), or content ID 4. **opt_pagePath**: The page on which the action occurred. Optional, defaults to the URI where the sharing took place (document.location.pathname). Can be manually set (like a virtual pagename).
I was tasked to implement this feature on a client website, so they can see social interactions in Google Analytics. here is how I did it:
Facebook & twitter does not want to share their data with Google but it seems google has figured out a way. basically,
What you need
Google Chrome Browser
Read the Google supplied guide which describes how to use Google Analytics to get interaction metrics on non-Google networks such as Facebook and Twitter & now there the script which you have to embed on the page you need to track social integration