Measuring Social Media with Google Analytics
Originally produced and presented by Graeme Benstead-Hume and SiteVisibility for the Brighton Digital Marketing Festival event September 2011. Measuring social media with Google Analytics covers a number of ways to segment your Google Analytics data to better measure the success of your social media campaigns.
Handouts for this presentation are available below or as a download here: Measuring Social Media with Google Analytics Handout.
Creating Campaign Tracking Code
Visit http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55578 or alternatively search for ‘URL builder’ in Google.
Website URL – Enter the URL you will be linking to from your social media activity.
Campaign Source – Enter the name of the social channel / site you are linking from, e.g. twitter.com
Campaign Medium – Will group your campaign sources together in your reports so enter Social or Social Media.
Campaign Name – Choose a more specific identifier for your campaign, e.g. twitter outreach.
Click on Generate URL and copy and paste the resulting text instead of your usual URL.
You can find your campaign report in Google Analytics under ‘Traffic Sources’ and ‘Campaigns’
This even works when the URL with tracking code is minified.
Creating an advanced segment for social media traffic
Login to Google Analytics and navigate to your dashboard report.
Find and click on the Advanced Segments drop-down button at the top right hand side of the report.
Choose the ‘Create a new advanced segment’ option in the drop-down menu
Advanced segments in Google Analytics are constructed from blocks which allow or disallow certain segments of traffic; in this case we need just one block.
Open the traffic sources drop-down categorised beneath the dimensions filters. Find the Source box and drag it up in to the empty dimension or metric box.
Change the condition to read matches regular expression
Under value input the following regular expression:
This should cover most of the social sites you might receive referring traffic from. If you promote yourself on any other social sites you can add them on to the end of the list using the pipe character | to separate each entry.
Finally give the segment a nice name and create the segment. You can check that the segment works properly by visiting your traffic sources report with the segment enabled.
Filtering Social Media Traffic
Navigate to the Analytics Settings screen where you should see your existing profiles.
Create a new profile with the Add new profile button.
Warning – if you do not create a new profile you may irretrievably lose data.
Add a profile for an existing domain and choose the domain you want to filter in the select domain dropdown. Give the new profile a nice name such as Social Media Filter and click finish.
Once you have created the new profile return to the Analytics Settings screen and find the edit button by the new profile:
Scroll down to the filters box and click the add new filter link.
Referring Traffic Filter
First set up a filter which only tracks referring traffic (We don’t want to miss any potential new social referrers!)
On the filter setup screen:
Select Add new Filter for Profile
Filter Name – Referrer Traffic Only
Filter Type – Choose Custom Filter – Exclude
Filter field – Choose Campaign Medium
Filter Pattern – Enter organic|(none)|direct|cpc|image
Case Sensitive – Select No
Social Media Medium Filter
Next we will group all of our known social media channels into a new medium named Social Media.
Click the add new filter link again and on the filter setup screen enter the following details:
Filter Name – Referrer Traffic Only
Filter Type – Choose Custom Filter – Advanced
Field A -> Extract A – choose Campaign Source and add our social networks regular expression as the value:
Field B -> Extract B – leave these blank
Output To -> Constructor – Choose Campaign Medium and name it Social Media
Field A Required – Yes
Field B Required – No
Override Output Field – Yes
Case Sensitive – No
Please note that our regular expression above has been truncated as we are allowed at most 255 characters in our field extract value.
Full Referral Path Filter
Finally we create a filter which will provide the full path of our referrers so that we can identify traffic from various campaigns even if they from the same social channel. This data is crucial if you are trying to compare the traffic arriving from two distinct profiles on Twitter.
This filter provides this data in the user defined report under visitors.
Filter Name – Full Referral Path
Filter Type – custom filter – advanced
Field A -> Extract A – choose referral and enter the value (.*)
Field B -> Extract B – none
Output To -> Constructor – choose user defined and enter the value $A1
Field A Required – yes
Field B Required – no
Override Output Field – yes
Case Sensitive – no