facebook google plus twitter
Webucator's Free Advanced Google Analytics Tutorial

Lesson: Social Media Analytics

Welcome to our free Advanced Google Analytics tutorial. This tutorial is based on Webucator's Advanced Google Analytics course.

In this lesson, you will learn how to begin tracking your social media activity right within Google Analytics.

Lesson Goals

    1. An Introduction to Social Interactions with Google Analytics.
    2. Setting up Social Interactions.
    3. Social Media Reporting.

Introducion to Social Interactions

With the growing popularity of social media marketing, many companies have a desire to learn more about what social media properties are performing the best, and which social media interactions are getting the most results for the company.

As we discussed in the Introduction to Google Analytics course, the new social media reports alone, are a very powerful tool in helping determine some of the answers to the above questions. By default, Google Analytics will automatically pull in social media traffic details from the biggest social media sources out there. For example, how many people clicked on one of your Facebook wall posts, how many Twitter users clicked on a company tweet and then made a purchase, and so on. These reports can all be found under Traffic Sources, then Social, and then you'll be able to choose your desired sub-report to dig into!

Now, many companies are using social media tools as a key marketing tool in content dissemination. So, they've embedded social media interaction tools right on their websites, including, but not limited to: Facebook like buttons, Twitter share buttons, and Pinterest pin buttons. Take a look at the screenshot below from the popular social media news site, Mashable.com.

Mashable Example

Each of those social media interactive buttons have a code behind them to connect the action to the desired result of someone sharing that specific article on the user's social media page, or feed. By default, Google Analytics will not track these interactions. But, the good news is, with a little coding work, all of this data can flow seamlessly into your Google Analytics reporting structure.

Setting up Social Interactions

Google has developed a very comprehensive guide to setting up interactions on this link: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSocial. The information in this sub-lesson will be a highlight of the steps needed to complete on your site.

One last item to cover before we begin. First, all of your Google+ interactions are automatically built into the Google Analytics reports. No need to do anything beyond having Google Analytics installed and a Google+ button on your website pages. Beyond Google+, Google Analytics currently offers tracking support for Facebook and Twitter. And here are the specific actions:

  • Facebook like
  • Facebook unlike
  • Facebook share
  • Twitter tweet

The general idea is that you need to add in _trackSocial code within each of the Facebook and Twitter actions. Below is an example of the full code needed

_gaq.push(['_trackSocial', network, socialAction, opt_target, opt_pagePath]);

The first two parameters, network and socialAction are required fields, while opt_target and opt_pagePath are optional. So, we need to add these parameters right within our social interaction code on our site. And each action, such as a Facebook like button, or a Twitter tweet button, needs to have this customized code built in.

Let's take a look at a Facebook like button example from Google's tutorial.

FB.Event.subscribe('edge.create', function(targetUrl) { _gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]); });

You can see that it is customized to the Facebook requirements. In the second line, you'll notice they have included the parameters of facebook and like, so Google Analytics knows where to place this action.

Overall, this process is fairly tedious, but the end result of having these actions listed within the Google Analytics reports can be very helpful. Let's get thinking about ways to use these tools on our own site in the concluding exercise next.

Social Interaction Setup

Duration: 20 to 30 minutes.
  1. Take a moment and read through the Google code page: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSocial.
  2. Take a look at one example, such as a Facebook un-like, and develop the code specific to your website.

Solution:

Talk through your solution in class and share with the instructor.

In the exercise example given above, here is the proper code for a Facebook un-like

FB.Event.subscribe('edge.remove', function(targetUrl) { _gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]); });

Social Media Reporting

Now that we've gone through the setup requirements, let's take a look at some more specifics on these reports.

To see the social engagement metrics, after the code has been successfully installed, this data will flow into the Social Plugins reports. This report can also be found under Traffic Sources and then Social reports. You can see an example of this report from the Google Analytics Blog.

Social Report

In this report, you will be able to see any of the social media interactions you setup earlier in this lesson and possible determine any actionable steps to increase your online marketing programs.

In this lesson, you have learned

  • How to Begin Using Social Interactions with Google Analytics.
  • How to Set up Social Interactions.
  • How to Track Social Media Interaction.