Yoast: Building Page.ly Part4: Scalable and Fast Managed WordPress Hosting | Page.ly Blog http://t.co/ba32Hemn
![]()
The analytics issue with Twitter
Twitter is great for traffic, but just how great it is, well, you'll never really know. Why not? You'll ask. Well, the only traffic you'll see coming from Twitter is traffic that comes through Twitters web interface. And most people I know don't use the web interface, they use desktop and / or phone clients. Because these clients aren't browsers, they won't pass along a referrer, and thus register as "direct traffic".
I won't even try to estimate what percentage of Twitter usage goes through the API, although I've heard people say it's up to 80 or even 90%, although Twitter Stats seems to report it as around 50%, and Twitstat.com as 60%. So you're getting a lot of clicks that look like "direct traffic" in your Analytics, but are in fact, not direct traffic. These people will behave differently than normal people who come to your site directly.
In an effort to improve the reliability of my Google Analytics stats a bit, I've decided to start adding Google Analytics campaign, medium and source variables to all my own tweets in which I promote my own posts. I know from cli.gs, the URL shortening service I tend to use, that my tweeted links get up to 300 clicks each, and I'd love to track the behavior of those people on my site.
So I've made a small "in between" script that I can use in a bookmarklet. What it does is simple:
- it grabs the URL and title from the request
- it adds the UTM variables
?utm_campaign=twitter&utm_medium=twitter&utm_source=twitter - it does a request to cli.gs through its API to create a shorturl
- it then redirects to twitter.com/home with the status set to that shorturl
Download the script here, and then modify this bookmarklet to use it:
javascript:(function()%7B%20window.open('http://www.example.com/clig.php?url='+encodeURIComponent(location.href)+'&utm&title='+encodeURIComponent(document.title));%20%7D)();
Set example.com to the domain name and path where you uploaded it.
This should allow you to create shorturls with the campaign tags in it, and thus track those tweeted links in your own analytics!
Tags: Google Analytics, Twitter
Category: Analytics, Social Media
You can skip to the end and leave a response.
Other posts you might like:
71 Responses to “The analytics issue with Twitter”
Comments closed, if you feel you have something to say:
drop me a line.
Google Analytics WordPress
Track your WordPress site easily in Google Analytics and add lots of data, for example views per author & category and automatic tracking of outbound clicks, pageviews & downloads.
Our Sponsors
Why Yoast is so speedy
Finding the WordPress hosting solution that's right for your site isn't easy. Trust me, I learned the hard way. You've probably noticed it though: yoast.com loads pretty darn fast.
That's because it's hosted on a VPS.net Cloud Server, and our static content is being served by MaxCDN: a huge network of content servers around the world.
Combined, it's the perfect hosting solution for this ste. Let my experience help you find the best WordPress hosting solution for your site!
Donate
If you like what I do, please consider donating a token of your appreciation.
Join Yoast on Facebook
Our Sponsors
Tags on Yoast
Affiliate Marketing Blogging WordPress Themes Reputation Management Twitter WordPress Plugins Social Media Google WordPress Hosting WordCamp Technorati XML Sitemap Conferences Hosting robots.txt PHP RSS Sponsored Reviews Spam Keyword Research Feedburner SEOktoberfest A4UExpo WordPress SEO Link Building Interview Facebook Personal Analytics SEM Apache Microformats Email SMX PPC SES Rich Snippets Greasemonkey Usability Web Design SEO tools Paid Links Rankings Online Marketing Google Analytics






Pingback: The Blog of Cligs - » Tweet & Track with Cligs and Google Analytics
by Anthony Parkes on 19 January, 2009 at 00:45
So you can actually track what those specific people do on your site? wow, that's pretty powerful... hat's off Joost
by Adrian Eden on 19 January, 2009 at 00:59
Very powerful indeed, nice post, its good to see what people are looking at and where they came from.
Pingback: Tracking Twitter and Shorten URLs in Google Analytics | Avangate Blog - Software Business Blog
by Steve on 19 January, 2009 at 15:05
Pretty straight forward campaign tracking for GA - I like the automated solution however.
I guess the flaw is when people link to your campaign tracking URL or bookmark it. The source is then no longer accuate. This could be solved in the case of people posting links using advanced segmentation etc. but do you have any ideas how to solve the bookmark situation?
Steve
@Danger_Mouse
by review plugin wordpress on 19 January, 2009 at 18:05
great site. thanks for the info.
by Joe Spencer on 19 January, 2009 at 23:57
Great solution for tracking tweet'd links, I´ll pass it on.
by Joe Dolson on 20 January, 2009 at 01:45
You may want to make a minor revision to this code - you'll need to check whether the URL already has parameters.
One simple option:
if ( strpos( $url,"?" ) === FALSE) { $url .= "?"; } else { $url .= "&"; } $url .= "utm_campaign=twitter&utm_medium=twitter&utm_source=twitter"; [/code]by Joost de Valk on 20 January, 2009 at 12:25
Thx a lot Joe, adapted it!
by Paul on 20 January, 2009 at 03:52
Great idea! Twitter traffic can (and should) be measured properly with the right approach.
by Aaron Peters on 20 January, 2009 at 11:47
Very nice, txs Joost!
by Ricky Buchanan on 20 January, 2009 at 14:47
Do these parameter additions not mess somehow with the tweetbacks code? I'm already having trouble with it - don't want to court more trouble!
Also, how do you get your RSS tracking into the RSS feed? Both seems to be very useful techniques.
Pingback: Analyzing Twitter Traffic | Sean Walther's Blog
by Alex on 20 January, 2009 at 21:50
Very interesting insight, will try that out! Thank you very much!
Pingback: WP to Twitter Update | Joe Dolson Accessible Web Design
by Brad on 20 January, 2009 at 22:36
For an interesting look at follower counts I set up a website that I planned to promote solely through Twitter, http://staires.org, a daily music thing. Admittedly there are a few things popular twitter users do that I don't: I'm not big on conversation (though I respond and try my best I don't strike up convos) and my content is very much "you can look once and determine if you care to click"... But I'm up to 630 followers now and I get about 20-30 actual visits a day. I have very little (almost 0) search engine traffic even after unblocking them in my robots.txt. Since this a post about analytics and if Twitter generates real traffic I figured I'd share my "high follower count" story.
Followers != Clicks.
by Gif Dump on 21 January, 2009 at 02:04
Easier way is to just send out your link with the tag ?twitter - so google.com/page.php?twitter
Same process but lessens the code soup you're adding at the end - easily will be recognizable in your analytics as traffic from twitter. But both ways have bad SEO written all over them.
Pingback: 7thgroove » Blog Archive » The analytics issue with Twitter - Joost de Valk
by Karri on 21 January, 2009 at 19:49
The websites I manage use OneStat, is there a way to track Twitter usage on that platform?
by JoSe on 23 January, 2009 at 18:35
Sorry for sucha a noob question, but where do I place the bookmarklet ?
by Brian St. Pierre on 23 January, 2009 at 19:17
Joost, thanks for a great solution to twitter referrer stats!
As implemented, a visitor may end up bookmarking (delicious, digg, etc) the URL with the campaign stuff in it. This would mess up your stats. To avoid this, include this script below the Google Analytics script. It modifies the browser history. The reason the RegExp is complicated is becase, as Joe points out above, there may be other parameters in the URL that you want to preserve. Disclaimer: I haven't widely tested this but it does work in FF2 (linux), FF3 (win32), IE7 with a handful of URL variations. Also, my javascript is weak so there may be a better way to implement this.
// Show a clean URL if this came from a tweet/cli.gs URL.
var campaignRe = new RegExp(/([?&])utm_campaign=twitter&utm_medium=twitter&utm_source=twitter(&?)/);
var loc = new String(window.location);
var match = campaignRe.exec(loc);
if(match != null) {
// Remove the crufty URL from browser history.
if(match[1] == "?" && match[2] == "&") {
// Change & to ?.
var cleanLoc = loc.replace(campaignRe, "?");
} else if(match[1] == "&" && match[2] == "&") {
// Preserve &.
var cleanLoc = loc.replace(campaignRe, "&");
} else {
// Just drop the params.
var cleanLoc = loc.replace(campaignRe, "");
}
window.location.replace(cleanLoc);
}
@Gif Dump: does this solution change your opinion about "bad SEO written all over it", or is there still some problem I'm not seeing? Can you elaborate about what you mean? The crufty URL is cloaked by cli.gs so I don't see the issue.
by php on 26 January, 2009 at 17:46
funny that you gave the code to the google dudes. hope they use it. :-) heeheee
by oneighturbo on 28 January, 2009 at 22:40
just came across this site, thanks joost. great stuff and this will be a great addition to our twitter unknowns!
Pingback: Econs.net Blog » Advanced Google Analytics - Zero Visits and Search Page Referrer
Pingback: OMNT Links of the Week #10 | Old Media, New Tricks
Pingback: SEO Costa Rica » Blog Archive » Advanced Google Analytics - Zero Visits and Search Page Referrer
Pingback: Advanced Google Analytics - Zero Visits and Search Page Referrer | ITegrity SEO Web Development Education
Pingback: Twitter Optimization Part 4: 10 Tools You Need for Business — SEOptimise
Pingback: Advanced Google Analytics - Zero Visits and Search Page Referrer : india sem
Pingback: A Tour Through a Large Blog’s Traffic - The Netsetter
Pingback: Segmenting Twitter Traffic in Google Analytics | Conversion Counts Blog
by jon perry on 11 March, 2009 at 18:14
It's a basic question and I hope I didn't overlook it, but to be clear, I am saving the text file as glig.php in the webroot directory. Where am I putting the javacode? In the theme index page?
Thanks!
Jon
by Joost de Valk on 11 March, 2009 at 18:19
Hey Jon, no the javascript code is a bookmarklet.
Pingback: Canonical URL Plugin for WordPress - Brian.Carnell.Com
Pingback: How To: Track Twitter Traffic In Google Analytics | EasyTweets
Pingback: 30+ Google Analytics Tools, Goals, Segments, Filters, Hacks & Resources | SEOptimise
by Gary on 13 March, 2009 at 11:05
Note, if your using the latest google analytics you don't need to set those variables at all. Instead create your own, for example ?track_id=5 and maintain a database to lookup and set the tracking info yourself following the conventions here http://blog.venture-skills.co.uk/2007/12/22/social-media-tracking-ga/
You can even go ahead and set a cookie to track browsers you have already run the code on and only run it once per browser.
Pingback: Strip Business — ArtPatient.com
by Jon Henshaw on 19 March, 2009 at 05:34
Joost, this is now supported in the URL link shortener http://kl.am
by Nikolai on 8 April, 2009 at 16:13
Joost, this sounds like a cool hack. I just have one question:
If people tweet a direct link to your site, without using the bookmarklet underneath the post, Google Analytics will still display that as direct traffic, right?
If so, is there a way to fix that as well?
Thanks!
by Joost de Valk on 8 April, 2009 at 17:21
To be honest: no.
by Andrew on 13 April, 2009 at 15:09
Here is how to do it with a simple bookmarklet: http://cli.gs/spp71M
Pingback: Tracking Twitter Traffic - Lee Willis’ Blog | www.leewillis.co.uk
by David Whitehouse on 28 April, 2009 at 11:30
I would say you would be better off specifying:
utm_medium = referral
utm_source = twitter.com
utm_campaign = Tweets
That way you can lump all the referrals together appropriately, lump all the twitter.com referrals together and just analyse it based on "Tweets"
by Cpatain Fancypants from CDU the band on 2 May, 2009 at 22:18
Hi, the script looks good as the shortening URL I use says hundreds of hits to my site, but the site is telling me it is only finding b/w 10 15 a day. As a beginner, where do I place the script to make this all work?
Cheers.
Pingback: How to Grow Your Blog Through Customer Development
Pingback: Trade Jim News » How To Grow Your Blog Through Customer Development
Pingback: TechWrap » How To Grow Your Blog Through Customer Development
Pingback: The Far Edge » Blog Archive » How To Grow Your Blog Through Customer Development
Pingback: How To Grow Your Blog Through Customer Development | Tech-Framers
Pingback: How To Grow Your Blog Through Customer Development | Site & Server
Pingback: How To Grow Your Blog Through Customer Development | Viningmedia Nieuws
Pingback: How To Grow Your Blog Through Customer Development « Preemo Technology Solutions [powered by The M Companies]
by Craig on 5 May, 2009 at 03:51
FWIW: I wrote a plugin for Mint that helps you track just these kinds of campaigns in realtime: http://craigmod.com/interactive/link_spice/
Pingback: 40 Ottimizzazioni per WordPress
by Tad Reeves on 13 May, 2009 at 20:00
Now that's a pretty slick idea.
Pingback: Kako pratiti SVE Twitter posjete kroz Google Analytics? | SeekandHit Internet Marketing
Pingback: 40 essential tips for wordpress blogs - Joost De Valk | Social Media Stuff | Justin Parks
by Carazoo.com India on 12 June, 2009 at 12:42
Nice bit of info. :-)
Pingback: 30+ Advanced SEO Tactics, Techniques and Resources (55+ Links) | CPA Talking | CPA Networks Talking, Making Money Online!
Pingback: RSS Week #45: articoli interessanti che ho trascurato - Matteo Moro
Pingback: How to Track your Success (or Failure) on Twitter
Pingback: Podcast Interview With World Leading Anayltics Authority Avinash Kaushik
Pingback: 85 Twitter Tools
by J. K. Taylor (OneTouch Massage) on 25 August, 2009 at 21:33
Thanks, Joost! I was baffled as to why I didn't have more Twitter referrals showing up in Google Analytics. Even my cligs analytics showed more than Google did. You always have the answer for those little things that bug me.
by Cricket Maniac on 8 September, 2009 at 12:30
I thought there would be some tracking for those visitors who are visiting my twitter profile
Pingback: How To Grow Your Blog Through Customer Development | Preemo: Media+Technology
by Paul Patrick Dale on 20 October, 2009 at 02:36
Thank you Joost! I only just arrived at a point where I can use something like this.
You're generous to share such great tips and tricks.
Paul
by Ashoka on 21 November, 2009 at 05:33
Great information as alway, I am going to try this on my site because it's almost impossible to track twitter traffic as you have so correctly pointed out.
Thanks again.
by Shrinagesh on 27 November, 2009 at 16:52
I've been looking for a solution to properly track twitter traffic and stumbled on this post from google. Though I am a frequent reader here, I somehow missed this post. I will check it out to see how this works for us. Thanks Joost
Pingback: How To: Track Twitter Traffic In Google Analytics | Free Leads On Twitter