A Google Analytics Social Engagement Tracking WordPress Plugin

By /

May 7, 2012

Telly Savalas - Who Loves Ya Baby

Social tracking in Google Analytics is changing.

Gone are the days where we measured social engagement as an aspect of a visitor.

Since I think sometime last week.

The social reports were under “Audience”. “Such and such a user” is socially engaged. We’d see whether socially engaged people were more likely to purchase something or complete a goal. Of course we had to add extra code to get that to happen with any other social sharing than Google+.

But how useful was that? So the person who shared your product on Twitter had a higher conversion rate? Is that really a shock?

Of course there was other information that was related to social media that wasn’t located there in the audience section. Referrals from social sources for instance. Looking at how often a page was shared, and then how often visitors to that page from similar social sources converted, was a far more complicated report to divine.

Well now it’s all about traffic. It’s about what that social sharing is DOING for you.  Those socially engaged people… What are they sharing, and what pages are being shared, and the people who come in from social media.. What are they up to?

It’s about the social traffic coming into your site, and how those different sources, actions, and hubs affect your conversion. It’s about putting it all in once place so you can best take advantage of it.

It’s about who loves ya baby*

I’m not going to talk about the new reports and pages in this post. Someday soon, we’ll go over all the new reports. But for you to make any kind of use of those reports you need to have additional code installed on your page so you can actually track your social engagement ahead of time.

One of the things that came up in questions and comments about a previous post about Social Engagement Tracking in Google Analytics was about plugins for WordPress, particularly whether a plugin like Digg Digg had social engagement tracking in it. Sadly, most don’t, and Digg Digg specifically does not. Which is sad because I put Digg Digg on my personal blog and really enjoy it. So I decided to solve my problems, and yours with a handy little WordPress plugin of our own.

That’s right! A LunaMetrics WordPress Plugin!

Now normal legal stuff… We’re releasing this under the terms of the GNU General Public License, so feel free to take this and modify it to your hearts content. This plugin has been tested with WordPress 3.3.2 and has been tested to work on at least my personal blog with Digg Digg and the LunaMetrics site using custom buttons, so most likely it’ll work with other social media plugins. But I didn’t test all of them, so you never know. For all I know you’ll install this on your blog and it’ll melt your computer. Well, it probably won’t. Okay, I’ll bet money that your computer won’t melt. But at worst it’ll conflict with some other plugin you have, so install it, and if you pop errors, uninstall it (but let us know what those errors are.. maybe we can fix it up for you).

(oh and if you don’t use WordPress, like I mentioned above, this is just code from our previous post. Go ahead back there and grab the code and do it the old fashioned way.)

LunaMetrics – Google Analytics Social Engagement Tracking Code – WordPress Plugin

This plugin inserts the code listed in the previous post here linked above that laid out all the various code you’d need to put on your site to have your social clicks tracked. Well, this does all that for you automatically. Just download the plugin and install and activate it, and you’re good to go. It doesn’t include the regular Google Analytics tracking code, nor does it put buttons on your page, all it does is behind the scenes code to make that other stuff work and track social engagement correctly. That way you can keep using your current or favorite social sharing button plugins, or your GA tracking code that’s hard installed in your header files, doesn’t need to be modified.

First, download the plugin, and make sure you know where it is. I have it in my downloads folder.

step1 - download the zip file

Now go to your WordPress installation, and navigate to your Plugins area. (If you don’t see Plugins, it’s because you’re logged in under a User account, and not an Admin account). At the top of the page, next to the Plugins title is a small button marked “Add New”. Click on that bad boy.

step2 - Go to your plugins page in wordpress

Now, underneath the “Install Plugins” headline are a few different links. Click on “Upload” which is right next to the bolded “Search”.

third - add a new plugin

Now you need to show it where your downloaded file is. Click on browse and find the file.

step4

Select the zip file you just downloaded above, and click open.

Now with the plugin selected, click “install now”

Almost there, all you need to do is activate the plugin. Click “Activate Plugin”.

And you’re good! Check out your plugin list and you should see the Google Analytics Social Engagement Tracking Code plugin installed. Note that I have Digg Digg and Google Analytics for WordPress installed here, to do my social media buttons, and my general GA tracking respectively. Without those, our plugin won’t do anything.

And that’s it! There’s no settings to set, or anything. Once it’s activated the code needed will be added to the head of your pages, and before the closing body tag, just as listed in the previous Social Engagement post. If you add buttons to your page, they should track socially now. So if before you were a little put out by adding code to some of your WordPress templates, you’re in luck. Now all you have to do are those 8 simple clicks listed above, and you’ll be able to better track your social engagement.

*If you aren’t familiar with Telly Savalas then Google him. Why do I have to do everything for you? Jeez.

Sayf Sharif is the Analytics Department Lead, working with Google Analytics and specializing in Usability and Conversion. He has helped hundreds of businesses design, develop, and improve conversion on their websites since 1997. Things you didn’t know about Sayf: he’s biked from Pittsburgh to Cleveland in 32 hours, studied Archaeology in Graduate School focusing on human tool use, and feels the Oxford comma is more important than Jim apparently does.

  • http://www.goodsignal.com Blair

    Hi Sharif,

    With the new Google Analytics Traffic Sources > Social reports, is it still necessary to add the code used with this plugin?

  • Sayf Sharif

    Well, some of the features of the new reports were there all along, they’re just more specifically called out. So you don’t need to add this tracking code to see when someone visits you FROM Facebook for instance. However if you want to see when people actually click on a share or social button, you’ll still need to add this code (other than for Google+ which is the only automatic one). Without a TrackSocial call, you won’t see whether they ‘engaged’.

  • Olivier

    I would strongly encourage you to publish it on the WordPress plugin repository. This would give additionnal visibility to your business :)

  • http://www.hostelmanagement.com/ Josh

    2nd vote for putting it on the WordPress plugin repository. That way it could be installed entirely through the dashboard.

  • Sayf Sharif

    It’s a great idea. I’d thought about it initially but time was of the essence to get the post up. Of course since then I’ve been busy with other things, however I will put this on my to do list to get it up, either in this form, or in the other more full featured but highly secret wordpress google analytics plugin i’m working on….

  • Mitch Neff

    Quick question – does this plug-in write the js snippets to the social plug-ins or simply act as middleware? Basically, if I were to install and then de-activate/uninstall the plug-in would the js code for social tracking remain persistently or disappear with the plug-in? I really like this approach. This makes things a lot simpler…

  • Sayf Sharif

    Mitch basically here’s how it works, it’s brutally simple. Seriously brutally simple.

    WordPress has different “hooks” which let you insert code at different spots on the page. We’re using two of them in the plugin. One to insert code of our choosing into the head of every page, and one to insert code into the body right before the tag on every page.

    Then we’re basically just pasting in the general code for that page for the various plugins. The code per the previous social engagement tracking page that belongs in the head, we slap in the head, the stuff that goes in the body we slap in the body.

    So if you deactivate it, the js code disappears from your pages. If you reactivate it, it will start showing up again.

    It’s pretty much as basic a WordPress plugin as you can get, but when all the other social plugins seem to be missing this piece, we felt that it was better to just make a plugin that added the social tracking code, which would still allow you to do whatever you wanted with your social buttons (whether that’s hard coding them, or using digg digg, or whatever).

  • Olivier

    If you put it on WP rep, please make sure that you use the same namespace, otherwise, early users won’t be notified about updates :)

    Then if you want to integrate it with the GA tracking code, I would suggest you to load everything in async mode :)

    Great work here! If you need some assistance to put the plugin on WP rep, feel free to drop me a mail, I have been through that already :)

  • Sayf Sharif

    Thanks Olivier, if people keep nudging me to get it in the WP repository I may actually do it!

  • Jacob

    Is this plug-in still available? When I try to download the .zip file I keep getting a 404 page.

    Has the plug-in been moved to the WP repository? If so what is its name? I couldn’t find it when I searched for it.

  • Sayf Sharif

    It’s not in the repository, i’m not sure what happened to the file on our servers however. it’s just gone, I need to confirm which is the latest file we have of it to put it back up in the correct spot.

  • http://mt4x4.com Keith

    Was excited to nab this plugin, then got a 404 :( Any chance it will be available again soon?

  • Rob

    Great work, but it seems I can not download the file.

    Can you please fix the link?

  • Sayf Sharif

    Link is fixed. Sorry about that fellas. It disappeared from our staging and production servers mysteriously, and then I got distracted by a shiny object. But I found it and have reloaded the plugin and the link above should work fine again.

  • Sebastian

    Giving this plugin a try right now. So far so good! The only test that doesn’t seem to be working is the Facebook interactions. Any idea why? Anyone else seeing this issue?

    Thanks for taking the time to make this plugin!

  • Sebastian

    Quick edit to my last post. Looks like LinkedIn isn’t working either. So far all I’m seeing under social plugin analytics are twitter and google plus. I only have facebook, twitter, linkedin & googleplus available, so 2/4 are working.

  • Sayf Sharif

    Sebastian, I’ll take a look at the plugin and see if there have been some changes that need to be taken into account.

  • Sebastian

    Tanks Sayf, I’ll check back to see if you found anything.

    Appreciate the quick reply!

  • Sayf Sharif

    Sebastian, for the linked in, it’s poor documentation on my part. The LinkedIn will only work if you add the function to the linked in share button as well as adding this code…

    http://www.lunametrics.com/blog/2012/03/29/tracking-social-google-analytics/

    Check out that link, which is the code this plugin was based on. Your share button for linked in should look something like this…

    …With the data-onsuccess=”LinkedInShare” being key there to running the function pushing a track social for LinkedIn.

    As far as Facebook I’m not sure. With the ga_social_tracking.js file which is included with this plugin, and the basic facebook scripts, it should be tracking. In my test environment it’s working. So I’m not sure. Are you using any other facebook scripts on the page which coudl be interfereing with the plugin?

  • Sebastian

    Sayf, thanks for the quick reply once again. I have a feeling it may be the plugin I’m using for WordPress that’s causing the problem. My social “like”, “share” buttons are added to my site using the “Really Simple Share” plugin which adds the buttons to the bottom of each blog post.

    Do you have a particular plugin you’re using to add the buttons or are you hard coding them in?

    Still odd that my Facebook isn’t tracking though, not like the plugin can create a “like” button without using the same functionality everyone else uses when creating that button for Facebook.

    Anyway, if you have any other answers for me, that’s awesome. If not, I still appreciate the time. Thank you very much.

  • Sayf Sharif

    We’re just coding them in manually, per that previous post. I have the code we’re using essentially there.

    is the like button showing up on the page and working, but simply not tracking, or is the button not showing up at all? if it’s not appearing, working, it could be a temporary thing with Facebook that isn’t delivering the code. I’m going to double check and confirm that Facebook hasn’t changed their code used here.

  • http://www.thiscureworks.com ian

    Hi Sayf
    Thanks for the article. My 8 yr old site and it’s .com/ pages had unique google analytics codes. I d like to keep that level of monitoring. Do u know how that would work now the sites been changed to a wordpress 20/11 site? Which folders are my different pages and posts in and where would I place each of the UA nos for each page?

    Thanks for any insights,

    Ian

    Any help would be

  • Sayf Sharif

    ian, i’m not totally clear on what you’re asking. If you’re asking in general where to put your google analytics tracking on a wordpress site, I recommend using the GA plugin by Yoast.

    http://yoast.com/wordpress/google-analytics/

  • http://www.jamilabbasy.com Jamil

    Thank you for making this plugin code! I just installed it and clicked on a like button, but I don’t have much site traffic at this time, and am wondering how I can see if it is working correctly? Which section of Google Analytics should I see these like / share clicks? How long does it take to activate?

  • Sayf Sharif

    I’d test it by putting it on a page, and then clicking on one of the social buttons and then watching GA real time. If you don’t have much traffic the hits should show up within 15 minutes within the standard reports. once you see the page hit that you did, look in social sources/actions and if you’re not seeing it there you’re probably not installed correctly.

  • Jamil

    Thanks…that’s my problem. I don’t seem to have the actions section under the social traffic sources on GA.

  • http://www.profromgo.com Chris

    Hi Sayf,

    Great plugin. I just did the GA 201 and 301 course this week in Oakland and glad I came across this while scavenging the internet for an “easy button” to track social engagement.

    I’m also using Google Analytics for WP by Yoast, along with a plugin called “Social Ring” on numerous WP sites I’m managing. Social ring seems to be gaining some popularity and traction.

    This made it so easy to add the ga_social_tracking.js file and I trust the version you have in the plugin is the one to stick with… I came across a few variations while digging thru “Google Code” and figured the one Sayf is using, is probably the best option.

    My two suggestions/requests:

    1. Definitely get this sucker in the WP repository so we can get updates if/when they become available. I think a lot more people will be looking for this in the near future.

    2. Write some more medieval javascript so this bad boy tracks “Pins” too!

    Thanks!

  • Sayf Sharif

    Chris,

    I submitted it to WordPress but I formated it wrong and they rejected it. It’s on my list to do it right and get it in there, I promise.

    A good reason is what you mention. If we ever can figure out a good way to track Pins. Right now we’re still dealing with a situation where Pinterest is not being particularly helpful in this regard. We’ve done some work arounds in the past, but none have worked 100%, and we’re really hoping the Pinterest API gets updated sometime soon to help us track these better. But if I ever do come up with a good clean way to add that on, I’ll be sure to post it here on the LunaMetrics blog.

  • http://www.yourprofitgrowth.com Craig

    Can anybody recommend a great social sharing plugin that is not your usual one with G+, FB, Twitter, LI, PIn etc. I am looking for something that works better than the stock std but integrates with facebook perhaps. Any ideas

  • http://www.enterpr1se.info/ Enterpr1se

    Hi,

    There’s a new Google Analytics trading javasceipt — analytics.js
    https://developers.google.com/analytics/devguides/collection/analyticsjs/social-interactions
    Is it possible to add this javascript support in the future?
    Thanks so much

  • http://www.chrometoaster.com Dave Turnbull

    Hi

    Thanks for this very handy plugin. It’d be super if Pintrest were added to your script – are there any plans to add such networks to your plugin?

    Cheers,
    Dave

  • Sayf Sharif

    Last I checked Pinterest had certain restrictions. You can track link clicks generally out to pinterest, but not in the same sort of engaged way that say twitter or facebook does. Plus this code is seeing it’s age, and probably needs to be looked at again on our part, and as noted updated for new analytics.

Contact Us.

LunaMetrics

24 S. 18th Street, Suite 100,
Pittsburgh, PA 15203

Follow Us

1.877.220.LUNA

1.412.381.5500

getinfo@lunametrics.com

Questions?
We'll get back to you
in ONE business day.