Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Tracking Social Interactions with Google Analytics

DZone's Guide to

Tracking Social Interactions with Google Analytics

· Web Dev Zone
Free Resource

Discover how to focus on operators for Reactive Programming and how they are essential to react to data in your application.  Brought to you in partnership with Wakanda

I’m spending time this week updating my social sharing buttons, claiming authorship of my blog posts, and linking with my Google profiles.

A big part of this is also to update my Google Analytics to track social interactions with kinlane.com and blog.apievangelist.com.

If you have set up both Google +1 and the latest version of Google Analytics on the same page, all +1 social interactions will be tracked automatically.

To get social interaction tracking and reporting for other networks like Facebook or Twitter, you need to integrate Google Analytics tracking along with each network button.

Using Google Analytics Social Tracking, you can record interactions range from a Facebook “Like” to a Twitter “Tweet.” This allows me to view track on these social interactions along with other traffic to my blogs, in my Google Analytics dashboard.

I added tracking for Facebook recommendations:

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

Also added tracking for Facebook shares:

FB.Event.subscribe('message.send', function(targetUrl) {
  _gaq.push(['_trackSocial', 'facebook', 'send', targetUrl]);
});

Then I added tracking for tweets:

twttr.events.bind('tweet', function(event) {
  if (event) {
    var targetUrl;
    if (event.target && event.target.nodeName == 'IFRAME') {
      targetUrl = extractParamFromUri(event.target.src, 'url');
    }
    _gaq.push(['_trackSocial', 'twitter', 'tweet', targetUrl]);
  }
);

There were not ready to go scripts for tracking LinkedIn and StumbleUpon. I will be working on these as I can, so that I can track shares from my blogs to these social networking and bookmark sites.

From http://www.kinlane.com/2011/07/tracking-social-interactions-with-google-analytics/

Learn how divergent branches can appear in your repository and how to better understand why they are called “branches".  Brought to you in partnership with Wakanda

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}