Wednesday, February 25, 2009

Adding Twitter Search to Google Analytics

Recently WebTrends blogged that Twitter search will now be listed in the standard search engine and keywords report in WebTrends. Omniture has also blogged about integrating Twitter search data into Site Catalyst.

As Twitter increasingly becomes a tool that people use to find information it is really critical for companies to know how people are finding their sites on Twitter. Doing so will allow them to incorporate that learning into future marketing efforts on Twitter as well as other sources (e.g. Google etc).

Since Google Analytics does not yet recognize Twitter search as a search engine like WebTrends or Ominiture does, I will show you how you can do it easily with one line of code.

However, keep in mind this solution only works when the search originates on Twitter (i.e. http://search.twitter.com). 3rd party tools like TweetDeck, those will not be captured in this solution (nor will it, I believe, be captured in WebTrends’ solution). Use this information to understand general search keywords being searched on Twitter but do not get caught up in actual number of visits that your Twitter efforts are driving.

So how do you capture searches conducted in Twitter?

GA provides a few functions to allow you to add your own search engines to the list of search engines that are already tracked by GA.

_addOrganic(newOrganicEngine, newOrganicKeyword)

You simply call this function right after var pageTracker = _gat._getTracker("UA-XXXXXX-X"); This functions to track any custom search engine.

Twitter uses "q" as the querystring that contains the keyword. So in this case our search engine is search.twitter.com and newOrganicKeyword is the value in query string q

So you code will look like

var pageTracker = _gat._getTracker("UA-XXXXXX-X");
pageTracker._addOrganic("search.twitter.com", "q")
pageTracker._trackPageview();

(Note: pageTracker._addOrganic("twitter", "q") will also work)

What will the reports look like in Google Analytics?

Note: For some reason I cannot get Twitter search to show up as Twitter in Google Analytics Search Engines report, it shows up as "search"(Maybe it’s a bug in GA? If anybody can provide pointer that will be a great help). However, for now this works fine as long as you know what "search" means in your search engine report. I am playing with filters and if I get that resolved I will post the fix or if you know the fix please email me.

Search Engines Report will show the following:



Drilling down to keywords will show the keywords on Twitter Search.



Looks like Twitter Search brings me repeat visits and more engaged traffic.

Comments? Questions?

My other posts on Twitter:

----------------------------------------------------------------------------
Looking to fill your Web Analytics or Online Marketing position?Post your open jobs on http://www.web-analytics-jobs.com/
Sr/Lead Analytic Warehouse/Java Engineer at Saas Company In the SF Bay Area (Emeryville, CA)
----------------------------------------------------------------------------
Site: AnilBatra.com
Twitter: http://www.twitter.com/anilbatra

3 comments:

  1. thanks for a great little post, ive tried these in the past, but wasnt getting enough traffic to roll it out across the whole site.

    will try it out, thought maybe if you used a filter you could change where it is displayed in google analytics?

    ReplyDelete
  2. Anonymous3:52 PM

    Hi Anil,

    Thanks for this great post! I was looking for topics on SEO and social networking....this fits the bill!!

    wilson (techie.prepys.com)

    ReplyDelete
  3. Thanks for a really useful blog. I couldn't get my head round where twitter was in my analytics before i found this. cheers

    ReplyDelete

I would like to hear your comments and questions.