So it looks like Google gave me something new to write about right away: _tracksocial. An event by any other name tracks as well, and so _tracksocial tracks much as any event does – utm.gif call and all.
Nick Iyengar points out that tracksocial doesn’t seem to add much that you couldn’t already do with events. However, as he also notes, having a dedicated set of reports for social interactions both gives room for social to grow, as well as providing some nice clean reports to work with. It also introduces a whole bunch of utm.gif calls and settings for analytics geeks to play with.
In this post we’re going to explore some of those.
Setting It Up
Google provides a wonderful table, which I have reproduced below (might want to look at Google’s as I just noticed this is unstyled), illustrating the parameters involved with _tracksocial.
_trackSocial(network, socialAction, opt_target, opt_pagePath) | |
network (String) | The network on which the action occurs (e.g. Facebook, Twitter) |
socialAction (String) | The type of action that happens (e.g. Like, Send, Tweet). |
opt_target (String) Optional. | The text value that indicates the subject of the action; most typically this is a URL target. If undefined, defaults todocument.location.href. For example, if a user clicks the Facebook Like button for a news article, the URL for that news article could be sent as the string. You could also supply any other ID identifying the target, such as an ID from your content management system. As another example, a user could click the Like button next to a blog post, in which case no value need be sent for this parameter because the current document location URL is sent by default. Note: If you want to leave this value undefined at the same time you want to supply a value for the next parameter (opt_pageUrl), you must specify undefined in your code. |
opt_pagePath (String) Optional. | The page (by path, not full URL) from which the action occurred. If undefined, defaults todocument.location.pathname plus document.location.search. You will only need to supply a value for this string if you use virtual (or custom) page paths for Analytic reporting purposes. When using this option, use a beginning slash (/) to indicate the page URL. For more information, see “Virtual URLs” in Typical Customizations. |
How it works
_tracksocial functions by making a gaq.push call, sending a utm.gif to Google Analytics. You can check out the utm.gif call it makes at the Google Analytics Social Tracking Demo. I’ve also included a sample below.
https://www.google-analytics.com/__utm.gif?utmwv=5.1.2b &utms=4 &utmn=1267893522 &utmhn=analytics-api-samples.googlecode.com &utmt=social &utmsn=facebook &utmsa=unlike &utmsid=http%3A%2F%2Fanalytics-api-samples.googlecode.com%2Fsvn%2Ftrunk%2Fsrc%2Ftracking%2Fjavascript%2Fv5%2Fsocial%2Ffacebook_js_async.html &utmcs=UTF-8 &utmsr=1680x1050 &utmsc=32-bit &utmul=en-us &utmje=1 &utmfl=10.3%20r181 &utmdt=Social%20Demo &utmhid=126490777 &utmr=http%3A%2F%2Fwww.google.com%2Furl%3Fq%3Dhttp%253A%252F%252Fanalytics-api-samples.googlecode.com%252Fsvn%252Ftrunk%252Fsrc%252Ftracking%252Fjavascript%252Fv5%252Fsocial%252Ffacebook_js_async.html &utmp=%2Fsvn%2Ftrunk%2Fsrc%2Ftracking%2Fjavascript%2Fv5%2Fsocial%2Ffacebook_js_async.html &utmac=UA-12345-6 &utmcc=__utma%3D100125134.1395102488.1312409837.1312409837.1312409837.1%3B%2B__utmz%3D100125134.1312409837.1.1.utmcsr%3Dgoogle%7Cutmccn%3D(organic)%7Cutmcmd%3Dorganic%7Cutmctr%3Dhttp%253A%252F%252Fanalytics-api-samples.googlecode.com%252Fsvn%252Ftrunk%252Fsrc%252Ftracking%252Fjavascript%252Fv5%252Fsocial%252Ffacebook_js_async.html%3B &utmu=qAAAAAAAAAAAAAAAAE~
With this request we get the following new parameters, and very little documentation on what they do.
utms: Technically not new since I see references to it online going back to April. It appears to be some kind of internal counter, but I don’t know what it tracks. Some claim that once it hits 500, GA no longer makes utm.gif requests.
utmsn: Social network, I am guessing. Labels the campaign that the request is associated with the “network” string above.
utmsa: The social action taken. Or at least so I assume.
utmsid: I am guessing the path defined by opt_pagePath
Confirming these with our coders now, and Monday I should have some firmer details on what each of these are, so check back.