This is the first in a number of posts we’ll be doing about the ways you can track inbound links from Twitter on Google Analytics.
First you need to decide which approach to take – you can filter out non-Twitter traffic, but that’s a slightly extreme approach. You can use UTM tags to tell Google Analytics your campaign names and redefine the source and medium of your links as Twitter, social, blogging or whatever you choose. But this permanently alters the data stored.
A good – and fairly easy – compromise is to segment your Twitter traffic data so you can display it separately from the traffic for your whole site in Google Analytics.
![]()
Segmenting Inbound Links from Twitter in Google Analytics
One easy way to segment your inbound links from Twitter is to append a piece of text to the end of the long URL, before you shorten it. I use spref=tw as this is the standard reference used for Twitter links by Blogger’s in-built social media tools.
Take your full URL and simply add a question mark and then your chosen reference – so, for example, you could be left with:
http://www.iondigital.co.uk/?spref=tw
Now shorten the full thing using the URL shortener of your choice – Ion.so is our own URL shortener, producing short links with just 17 characters, and with TweetDeck API integration (see below).

Setting Up Segmentation in Google Analytics
Now head over to Google Analytics and look for the ‘Advanced Segments’ list up top. Click it, and choose the option to add a new segment – the positioning of these options depend on whether you’ve switched to the new version of Google Analytics, but they’re fairly easy to find in either version.
Set your segment to Include Page Containing spref=tw, name your new segment and save it.

When you click the ‘Advanced Segments’ dropdown list from your account dashboard now, you should have the option to display only results which contain spref=tw – make sure you append this to each link you share on Twitter, and you’ve basically enabled social media tracking for your Google Analytics data.
Integrating Google Analytics Tracking into TweetDeck
With Ion.so and TweetDeck’s API, you can have spref=tw appended automatically to each link you tweet.
In TweetDeck, open the settings dialogue by clicking the wrench icon up top.
Click on to the ‘Services’ page and set the following as your Other URL Shortening Endpoint:
http://ion.so/index.php?api=1&return_url_text=1&longUrl=%@?spref=tw
Now each link you tweet in TweetDeck will automatically shorten to an Ion.so short link, with the spref=tw suffix added by default – making it effortless to track the success of your social media efforts in Google Analytics.

