social media how toDon’t you wish you could track the traffic impact of Twitter, Facebook and Google+ using Google Analytics? Well now you can. Keep reading to learn how.

Google’s getting social in a big way.

Google has been quite busy lately, rolling out Google+ (Google’s social network) to a limited audience, the Google +1 button (a feature similar to Facebook’s Like button), a new Google Analytics interface and Google Analytics Social Interaction Tracking.

Google Analytics Social Interaction Tracking

This new Analytics feature allows you to track social interactions on your website, your blog or on your Facebook fan page. These actions include the Twitter button and the Facebook Like, Unlike and Send actions.

In this article, I will guide you step-by-step in adding this powerful new tracking feature to your Facebook tabs or web pages.

NOTE: Adding Google Analytics Social Tracking requires access to and modification of your web page files. It’s pretty basic, but you should be somewhat comfortable working with HTML files.

What is currently supported by Google’s Social Tracking

As of this writing, my testing shows that the following social buttons are supported:

  • Facebook Like, Unlike, Send
  • Twitter (only via the “official” Tweet button, not Tweetmeme or other third-party buttons)
  • Google+

I’ve not yet found a way to track the LinkedIn Share button. If anyone has had success tracking this button with the new Google Analytics, let me know in the comments!

As for WordPress plugins, you’ll have to wait for plugin developers to integrate social tracking into their plugins. The one WordPress plugin for adding Google Analytics social tracking only supports the buttons listed above.

Google’s New Google Analytics Interface and Tracking Code

In order to implement Social Interaction Tracking, you will have to update your current Google Analytics code to the latest version, and then add a few snippets of code to your HTML file.

In order to view the Social Interaction Tracking metrics, you will need to use the new Google Analytics interface, which is available as an option at the top of the page when you’re logged in to your Analytics account:

New Google Analytics Interface

How to Get Your Updated Analytics Code

To get your updated Google Analytics code:

    1. Log in to your Google Analytics account.
    2. View the new Google Analytics interface by clicking “New Version” at the top right of the screen (see above image).
    3. Click on the domain account you wish to access.
    4. Click the “gear” icon, in the orange bar at the top right of your screen:

GA Gear Edit Icon

    1. Click on the “Tracking Code” tab: Under “Standard” tab and below “1. What are you tracking?” select either “A single domain” (if you’re tracking a website or blog) or “Multiple top-level domains” (if you’re tracking a Facebook fan page).

GA Tracking Code Tab

  1. Copy the code under “2. Paste this code on your site”. It should look like this, but with your “UA-xxxxxx-x” account number:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxx-x']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

You now have your updated Google Analytics code.

Putting the code in all the right places

The new version of your Google Analytics code should be placed before the closing </head> tag of your HTML file. (Yes, this is different. The old version was usually placed before the closing </body>, but that was then…)

Between your Analytics code and the closing </head> tag, insert this bit of code that calls the JavaScript that enables the social tracking:

<!-- Google Analytics Social Button Tracking -->
<script type="text/javascript" src=""></script>

The end result will be:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxx-x']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
<!-- Google Analytics Social Button Tracking -->
<script type="text/javascript" src=""></script>

The “UA-xxxxxx-x” will be replaced with your unique Analytics ID for this domain.

Now let’s add the Like/Send button code

As I mentioned in my Social Media Examiner post on Social Plugins for fan pages, Facebook generates the Like/Send button code for you on its Social Plugins page. For the Like/Send button, you just need to enter the URL you want people to “like”, select whether you want to include a Send button and a couple of other options, then copy the code in the popup dialog, which will look like this:

<div id="fb-root"></div><script src=""></script><fb:like href="" send="true" width="450" show_faces="false" font=""></fb:like>

The “#appId=xxxxxxxxxxxxxxx” is a random app ID that Facebook generates that allows you to access Insights for the button, but it’s not necessary for the button to work. In my example, I omit the appId value from the code, which will work fine.

IMPORTANT: You must add the snippet of JavaScript (shown below) to the code that Facebook generates so that actions on that button trigger Google Analytics:

<script type="text/javascript">_ga.trackFacebook();</script>

Add the above code before the <fb:like /> tag:

<div id="fb-root"></div><script src=""></script><script type="text/javascript">_ga.trackFacebook();</script><fb:like href="" send="true" width="450" show_faces="false" font=""></fb:like>

Paste your Like button code anywhere between the <body> </body> tags.

Viewing your Google Analytics Social Tracking reports

As mentioned above, the Social Tracking reports are only available in the new Google Analytics interface. (See above for how to choose the new version option.)

NOTE: It usually takes a few hours for Analytics to reflect activity on your web pages, but it can take up to 24 hours. See “Troubleshootingbelow.

After logging in to your Analytics account, click into the domain for which you want to view reports, then in the left menu go to “Visitors > Social“:

You have three options for viewing the social interactions:

    1. Engagement: You see two metrics: 1) Not Socially Engaged and 2) Socially Engaged. This shows you how effectively each page is in motivating users to Like or Tweet your content:

    1. Action: This shows you the specific actions taken (Like, Unlike, Send), how many of each and percent of total actions:

  1. Pages: Details on which page’s actions were taken and what those actions were.

Adding the Twitter button to the mix

Google’s Social Tracking will also track tweets made with Twitter’s Tweet button. Interestingly, Tweetmeme now recommends using the Twitter Tweet button.

After logging in to your Twitter account, go to the Twitter Tweet button page, where you can select one of the three available options:

Twitter Tweet Button

Once you’ve made your selection, just copy the code that is generated for you and paste it somewhere between the <body> </body> tags of your web page. Your code should look like this:

<a href="" class="twitter-share-button" data-count="horizontal" data-via="hyperarts">Tweet</a><script type="text/javascript" src=""></script>

Add a bit of JavaScript to activate Twitter Social Tracking

Before the closing </head> tag, place this bit of JavaScript to activate the Google Analytics tracking (the social tracking won’t work without this tag!):

<!-- Load Twitter JS-API asynchronously -->
var twitterWidgets = document.createElement('script');
twitterWidgets.type = 'text/javascript';
twitterWidgets.async = true;
twitterWidgets.src = '';
// Setup a callback to track once the script loads.
twitterWidgets.onload = _ga.trackTwitter;

I don’t think it matters where you put the above Twitter-tracking code, as long as it’s inside the <head></head> tags. I put it right before the closing </head> tag, after the Google Analytics tracking code and the call to the “ga_social_tracking.js” JavaScript.

A word about Google +1 tracking

As Google states on its page about Social Interaction Tracking,

Out of the box, Google Analytics provides integrated tracking with the Google +1 button. This means 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.

As I mentioned above, the +1 button is Google’s version of the Facebook Like button. I’ve added it to the HyperArts website and blog, but I haven’t seen much traction with it yet. However, adding it can’t hurt, and as it grows in popularity it will help your content reach a larger audience.


If you implement the above instructions accurately, you should see tracking results within several hours of initiating tracking, although Google says it can take up to 24 hours to display results.

If, after 24 hours, you don’t see any social tracking results (and I’m assuming you will have done some testing of the buttons to ensure they work and to provide some data to Analytics):

    • Double-check your code. Make sure you have placed the code as instructed above, and make sure your URL values are correct.
    • Check the Google Analytics date range. By default, Google Analytics displays the past month of data up to the previous day. You can manually change that range to include the current day by clicking the arrow next to the date range and changing the end date to the current day:

GA Date Range

  • Adding Social Tracking to your WordPress self-hosted blog: There is already a plugin for this feature.

Although this may look a bit, um, complicated, it should be pretty easy for those who are comfortable working with web files.

What are your thoughts?  Do you have questions? Please leave your comments in the box below.

Tags: , , , , , , , , , , , ,

Get Social Media Examiner’s Future Articles in Your Inbox!

Join 465,000+ of your peers! Get our latest articles delivered to your email inbox and get the FREE Social Media Marketing Industry Report (56 pages, 90 charts)!

More info...
  • Great tutorial Tim.

    In my opinion all these social signals will play an important part in ranking factor in Google soon.

    Is there any plugin for wordpress to add twitter’s tweet button on posts or after adding the above code as mentioned above will show the tweet button on my all posts?

    Thanks for your help. Tim

  • Thanks Tim. That’s very helpful.

  • Great post. 🙂 

  • Preston D Lee

    This has been super helpful. Thanks for sharing. Could you clarify on one thing, you said to add the event tracking code “above code before the tag”. Did you mean above the or ?

  • I can’t tell Tim how much I love this have saved me hours of figuring this thing out. I will be getting started with this today.

    “Black Seo Guy “Signing Off”

  • I should let every know that I’ve written an article about using the new Google Analytics for tracking social plugins on Facebook iFrame tabs:

    Just a heads up!

  • The example right below that sentence should make it clear, Preston. You want to add the tag before the opening  <fb:like> tag.

  • Carla Anglin


  • Thanks Tim.. Great post!!.

  • This is just what I have been looking for! I think I’ve put the codes in the wrong place. You continuing free information has made me a loyal follower. Thanks!

  • Thanks for the guide, I’ve printed it and will start tracking the social engagement on my site soon!

  • BlogSerRP

    That´s it! Simple like that!

  • Pingback: How to Track Tweets, Facebook Likes and More with Google Analytics |

  • Pingback: How to Track Tweets, Facebook Likes and More with Google Analytics | fozbaca’s WordPress()

  • Pingback: Track Tweets, Likes, +1 on Google Analytics | George Files()

  • Scotty

    Can you also see FB shares/posts, Tweets, etc. as a traffic source?

  • Yes, I found Google’s instructions on how to set up this tracking to be incomplete, and I tried to complete them. Thanks!

  • If you use Twitter’s Tweet button, you can track that as I laid out in this article.

    You can track Facebook Likes, Unlikes, and the Send button.

    I also have a post on my blog on how to track the Facebook Comment box social plugin with Google Analytics.

  • Bill Lord

    Thanks again Tim! Great post, you’ve found another way to streamline these tools. This will be great for showing clients their insites on Facebook, and then how that has effected their website’s traffic with Google Analytics.

  • Thanks Bill! As mentioned above, I also wrote a recent article on how to track the Facebook Comment box social plugin with Google Analytics.

  • This is just what I need! Thanks for this tutorial Tim. 

  • I find this to be very useful, as Google has provided a more comprehensive view of how your content is being shared from share buttons. My guess is that they will expand upon this type of data.

  • AngieVanDenzen

    Thanks Tim, can’t wait to pop this onto some of our sites & see a better picture of how our websites & social sites work together! 

  • What an amazing detailed article Tim. Thank you for providing such clear directions and for spending the time to add in screen shots. I am going to make sure to update my site to include these social analytics. 

  • This is a great post and certainly helps many of us. I have followed Tim Ware on his website and he always provides great advice and is willing to give back. Thanks Tim and I look forward to more articles from you on Michael’s website. Cheers!

  • Hi Tim, got a question, I followed your instructions and added those “like” and “tweet” buttons, but they are appearing at the way bottom of the page and the twitter button is in the middle bottom of the page, how can I position them nicely next to each other say right before or after the content?
    Here is how it looks like right now:

    Thanks for your help! Its obviously a great article since I took action right away =)

  • hi, Tim 🙂  just a brief one, from a total novice:  under social interaction//action viewing, do i need to add the twitter and facebook accounts somehow, or will they simply pop up within 24 hours?!?  if i need to add, how?!?  thanks 🙂  it would be great for this thing to work 😉  cheers!

  • Ronnie

    I am assuming we delete our current (old version) of GA, when we add the new one? correct.

  • Pingback: WeddingWire Pro Blog » Blog Archive » Track Tweets, Likes, and Pluses with Google Analytics()

  • Great information coming at the right time. Just recently I moved to a WordPress site because of the plugins for social media. Tracking clicks was one of my issues.
    I love this site about social media.

  • great article and great tips! using them right away 🙂

  • Hi Condru, Once you have all the analytics coding set up on your pages and, of course, you’re using the new “asynchronous” tracking code, then tracking will just show up in Analytics. There’s nothing you have to do within the actual Google Analytics control panel EXCEPT make sure you use the “New Version” of Google Analytics interface which you select in the top right links of any page, as illustrated in my article. Good luck!

  • Thanks for the kind words, Gordon. Much appreciated! Tim

  • How I Love you guys, Let me count the ways:
    1. Timely, accurate info.
    2. Helpful, relevant screen shots and demos.
    3. User friendly.
    4. Just because.
    By the way, we’re having a discussion in my office about tracking in GA while using custom WordPress plugins and Shareaholic plugins. We’re unsure at this point if code snippets need to be added to the GA script for each account or not. Have you any insight Tim?

  • Great read. Very useful.

  • Brian, I see your site is built on WordPress CMS. Where those buttons show up on your pages depends on how they’re coded. How did you implement them? If you did it by hand, then you’ll have to sort out the HTML/CSS issues that are causing them to show up at the bottom of your pages.

    You can add plugins for these social buttons but you’ll have to make sure the plugin you install includes the code for tracking button usage via Google Analytics which is the subject of my post.

    I’ll be writing up how to manually do this with a self-hosted WordPress installation. It involves edits to header.php, index.php and single.php files. You definitely have to be comfortable working within code to get it right.

    So you can wait for my post, which I should have ready this week, if you want to hand code it. Or wait for a WordPress plugin that handles it. Keep checking the WordPress Plugins page.

    Hope this helps!

  • Definitely!

  • Aww shucks! Thanks Laura.

  • thanks 🙂  i’ll just wait 🙂  cheers!

  • Google Analytics is amazing!  I use it everyday!

  • I’m not sure what you mean by “for each account”? If you mean Google’s ga_social_tracking.js, then the default that Google provides includes Google +1, Facebook Like/Unlike/Send, and Twitter. I just posted on the HyperArts Blog an article on how to track Facebook Comments Box Social Plugin, by adding a bit of JavaScript to the ga_social_tracking.js code.

    There’s currently a bug with the LinkedIn Share Button that prevents it from being tracked in Google Analytics.

  • Great post, really informative. I’ll be investigating this further!

  • Hi Tim, thanks for this great article! One quick question – I don’t have the anywhere in my facebook code. My code currently looks like this:

    Where should I put the GA code to trigger the analytics?

  • Liz Horgan

    Tim –  thanks for sharing. I’m not technically adept, so my question is more of a big picture one….is this the best way to measure engagement?  Are there other tools with less set up involved?  Can you speak to the options available?  Thanks!

  • I do think it’s a powerful tool for measuring engagement, what content gets shared and via which social media channel. I’d say the main benefit of Google Analytics social tracking over Facebook Insights is having all the social channels and metrics available on one screen.

    You can see which social buttons perform the best (I was surprised when I finally got the LinkedIn Share Button to be tracked in Analytics, that it outperforms the Facebook Like button and demolishes Google +1).

    I’m sure there are things that Facebook Insights does that GA doesn’t do. But it’s only for Facebook and access to the data is complicated by the fact that data for different Web properties is under different admin screens.

    A comparison of the two will likely be my next blog post 🙂

  • UPDATE: Although I thought I’d figured out how to track LinkedIn Shares via Google Analytics, and even wrote a post about it, it turns out that a bug in LinkedIn’s API is causing Analytics to record a share every time a page with the button loads! So we’ll have to wait for LinkedIn to fix that.

  • Tim, you are heaven sent! 🙂

    This is what I was just researching for days about and you’ve made it very easy to understand.
    I am now reading your blog ^^

    Are the above steps the only ones needed to be taken even if my website has several social buttons (like, share, tweet) say per every page and content?

    Thank you,


  • Aaron

     Question – I noticed the link to the ga_social_tracking.js isn’t working? URL in the code being –

    Is this an error, or do we need to self-host this JS ourselves, and does anyone have it?

  • Tim,
    Thanks for sharing…Very useful….Great Post

  • Yes, Aaron, that’s a typo! In that URL, change “_js”  to “js” (just remove the underscore). Sorry about that! I’m having this corrected in the post. Thanks for the heads up!

  • Lace, Every page that has the buttons needs to have the code. Thanks! Tim

  • Great
    post once again Tim.

    You always are on the edge of thinking outside the box and very


  • Great Article about Google Analytical Code.

  • I downloaded the script, and placed it on our server, so it is always available.

  • Paul Lombardi

    Tim, we currently use the analytics code on our site however for our social media interaction, we use the Wibiya toolbar.  Since there is no “like” or “tweet” button code directly in our site, I would think this addition to the tracking code would not help us.

    Our site is,

    Thank you for your help…

  • WOW! It’s very good!

    Excellent article!

  • Pingback: google analytics for social media |()

  • Ariful Haque

    Nice article.

  • Boben

    I don’t have the , but a
    How can I track that ? thanks

  • Great article, thanks! It will be interesting to see how the “social toolbar,” or sharing bars, evolves. This method is more accurate since it utilizes the API’s directly from the source and not another third-party.

  • Elisavov

    According to Google you can integrate the social tracking snippet also into the traditional tracking

  • carolineh

    Brilliant article… I will be adding this to all the websites I have built, which interact with social media (a number I’m trying to grow!) Please could you just clarify… I have switched to the new version of analytics to copy the new code, however, I already have the old analytics code on the website, I’m assuming I replace the old code with the new, however for some reason it says:

    Tracking Not InstalledLast checked: 31-Dec-1969 16:00:00 PSTThe Google Analytics tracking code has not been detected on your website’s home page. For Analytics to function, you or your web administrator must add the code to each page of your website.

    I do already have tracking installed, do I just replace despite this or have both?

  • Boben

    i have the same problem

  • Pingback: How to Track Tweets, Facebook Likes and More with Google Analytics | Sighede´s Social Media Newsroom()

  • You do have to replace the old tracking code with the new. I recall seeing that message in the new version, about the tracking not being detected. It’s probably a bug. If you switch back to the old Analytics interface, you can check if it’s tracking and I found that mine was tracking fine, despite that message. Lots of bugs to be worked out.

    But if you’re seeing tracking results with your new tracking code, it’s working.

  • You can’t. I’d suggest using the XFBML version of the , not the iframe version.

  • Sorry, Peter. I had mistyped that URL. It should be We’ve fixed this error in this post. Cheers….

  • caz1497

    Great – Thanks very much. I had assumed it was a gliche but was seeking confirmation before changing all the coding. Thanks for a great article, really vital to what I do.

  • Boben

    okay thanks

  • This is awesome information. Thanks for sharing. My tech team were planning to custom build tracking tools for “Likes” etc on our site. Now they don’t need to. Thanks again!

  • Guest

    did anyone get this to work? I followed all the steps and I’m not receiving anything although i’ve been liking/unliking my page a bunch of times yesterday. The ‘non-social’ traffic does show on my analytics so I know the basic features are working.

  • Sorry, man, you totally lost me at “Putting the code in all the right places”

  • Leo

    Tom, I read that the ‘ga_social_tracking.js’ file must be hosted under a secure/HTTPS server in order to work. Could you confirm that?

    I hosted it on my server, which I’m not sure is secure, and I’m wondering if that’s why I’m not receiving any social traffic.

  • I gave this post a Like on Facebook just to help your Social’s Metrics, lol.

    Very good text and very easy to understand.

  • It should be hosted under HTTPS *if* you’re using this on a Facebook iFrame tab. It works fine hosted under HTTP if you’re using it on a website.

    Have you tested your social buttons on your site and then looked for the tracking in the *new* Google Analytics interface? Make sure you’ve read this article closely. If you use the old tracking code or try to view social actions in the old interface, it won’t work. And double-check your coding etc. Cheers!

  • LOL! Someone should write a song!

  • Did you change the date range in the *new* analytics to show the date you’re testing? Remember, by default Google Analytics shows the previous month up to the previous day.

    Then I’d say double-check your coding.

    Hopefully, there’s not an error in the code in the article. I did check it carefully, but I’m only human 🙂

  • So if I have WordPress although I can edit the root file and the header code because a plug in provides the buttons I can’t insert the java script for the FB like button etc. correct? Or does that go in the header also?

  • Right, Camden. If you use a plugin for your WordPress social buttons, I don’t think you can modify the code they generate. And the button, as I describe in this article, needs an additional JavaScript function called when it’s clicked.

    So you can either wait for a plugin that incorporates this code or hand code the social buttons and manually add them to the index.php and single.php WP templates.

    And, as you mention, the stuff goes in header.php.

    I’ll very soon be writing a post about manually adding the GA tracking to self-hosted WordPress sites.

  • propagandahouse

    Thanks Tim great guide here – and about time Google added social tracking to their analytics!

  • Fiona

    Hi, great article thank you .Do you know how to track QR code clicks?

  • Elisavov

    I meant integrate it into the old GA version (synchronous tracking) — can anyone confirm this?

  • Can’t wait to start tracking! Thanks for the informative post. 

  • Leo

    I did use the new tracking code, and did read this article very carefully. I double checked every bits of code I added, and somehow it still isn’t working…

    I just don’t know what to do now. The website I’m trying to ‘social track’ is, if you could have a quick look at it and perhaps find why it’s not ‘social tracking’, you’d be my hero! 

  • Leo

    hey Tim,

    I did check, double check, triple check everything. I’m out of ideas now. I’m using the new tracking code, followed your steps very carefully. Still not working.

    I replied earlier with my website’s url for you to check if you had time but I guess that’s not allowed here. So since I can’t show you my code, I guess all I can ask now is if you can think of anything that might explain why it’s not working?

    As I said earlier, basic/old version stats are working, but social ones like facebook likes/tweets are not.

    I’m testing this on the website of a company called Ultimate Washer, on the index.htm page only, in case you want to have a look (and if this doesn’t get deleted again). 

    Thanks a lot,


  • Leo, I looked at your code and I see that you link to ga_social_tracking.js under HTTPS. I’m not sure why you made it a secure URL, but I suggest changing that to simply http://. Everything else seemed to check out.

    And you are using the NEW Google Analytics to view your tracking, and you’re setting the data range to the day you’re testing?

    That’s all I can think of. Let me know if you get it working and what the issue was.

  • Leo

    Yes, I’m using the new analytics, and Google+ traffic is working.

    I will change to http:// and let you know how it goes, thanks!

  • Pingback: beautiful bytes – the Google news keeps coming | beautiful world()

  • Leo


    I think my code was actually working from the beginning. Your ‘like’ showed up, and that was before I made the change.

    I was testing my code by liking/unliking the page with my facebook account, but I guess that doesn’t work. Maybe Google has a way to see that and does not record it.

    I liked/unliked the page a few times after seeing that your ‘like’ had been recorded. Nothing happened. I then asked a friend to like the page, and that was recorded.

    Anyway, you might want to add this to your article 🙂

    Thanks a lot for your help!


  • Mtavora2002

    Question about the javascript code, do I need to use this code from or can i save the javascript file directly from my server? My concern was, if this is not google owned server/domain… it may go down in the long run and the tracking will not work anymore…

  • Glad you sorted it out, Leo!

    Make sure you don’t have a filter set in Google Analytics to not record visits or actions *you* take from a specific IP address. That may be why you’re not seeing your own tests.

  • Leo

    Where would I be able to check that?

  • You don’t have to use that host. You can upload the ga_social_tracking.js file to your own server and call that URL. Sorry for the confusion!

  • Click on the gear/cog icon in the far right of the orange bar. On the next screen you’ll see the Profiles tab and the Assets tab are highlighted. You’ll see a “Filters” tab a few to the right of the Assets tab.

    If you’ve never set up a filter, then you shouldn’t see one now. But perhaps someone else set that up for you and filtered out results coming from your home or office. This is generally the best practice to ensure accurate stats, but for testing you’d want to temporarily disable or remove that filter.

  • Very Helpful. Thank You!

  • Mtavora2002

    Thanks Tim! This is awesome!

  • Leo

    You’re the man.

  • Pingback: Google Plus Buzz Love it or Hate it()

  • Aaron

    Is anyone having issues with tracking Twitter? I’ve implemented this and starting to see Likes and +1, however no Twitter yet. Have implemented and double checked code used, have ensured date range is correct and ensured no Filter is set to ignore interaction from tests.

    I found someone else with a similar issue but Google fixed their source examples – not sure if code shown/used here may also have a typo? Example –

  • Rob Neff

    Once more – great article!
    1. You might want to bold that the tracking code placement has changed! Ouch!
    2. Also, I am not seeing the schedule reports – weird. Are you? If you do can you send a screen shot?
    3. In lieu of the icons, I use @addthis:disqus – I see it as an event. Is there a way to track the selection(s) in this?


  • Benjamin Hübner

    Great post here! I)´m using Postrank analytics at the moment to track social interaction,but this seems to be a lot better!

  • I would like to know the way to track the selection in Addthis too. Is it possible? Thanks.

    This should help:

  • Great post! Awesome addition by Google.

    Until now, I used to track social activity using the Google URL builder (

    This might also help you track sharing through LinkedIn. For campaign source I set “social_sharing”, for medium I set “linkedin” (or any other medium such as Facebook, Twitter, or Google+) and for campaign name “general_campaign”.

    This little trick will provide you with a nice overview of the amount of shares in Google Analytics.

  • Alex_Votocracy

    It will be interesting to see how Google+ will be used in the future. Read about how “Double Rainbow Guy” started his candidacy for president on Facebook:

  • Pingback: How to Track Tweets, Facebook Likes and More with Google Analytics | Social Media Examiner « FOG BLOG :: FOG Valley :: design services & marketing solutions :: San Jose CA()

  • Stephen de lange

    Does this work with the wordpress Social Media Tracking plugin? Or do you have to hardcode the buttons?

  • Pingback: Facebook Business Marketing Links, 7-22-11()

  • That plugin would say if it is set up for the new Analytics social tracking. If it’s not, you’d have to hard-code into your WordPress files: header.php, index.php, single.php (or however your particular template names the header, landing page and single-post files).

  • Stephen de lange

    The plugin only says it is installed, I can see it is displaying the buttons, It also only displays google +1 in analytics – here is the url maybe you can look at the source to see if I implemented your script correctly?

  • Stephen, I checked out your source code. You won’t get the Analytics tracking for Facebook & Twitter because it’s not coded as shown in this article. Just compare your source code to the examples here.

    So if the social buttons on your site are generated by a WordPress plugin, that plugin isn’t set up for tracking with Google Analytics.

  • Thanks so much, Tim.  The WordPress plugin you gave a link to above (which actually is called “Social Media Tracking” as mentioned by Stephen in the last comment, so that’s a little confusing), puts the buttons in a rather messy order.  I’m currently using the “really simple share” wordpress plugin.  It’s not set up for Analytics automatically, but if I add the code in my header, etc – should it work as long as the button links are coming from and  (To clarify – you said it won’t work with “third party buttons”.  Does that mean that I have to actually go to Twitter’s official page and get it to generate the button for me for it to work, or as long as the plugin generating the buttons is doing it from, it’s fine?)
    Thanks for the help!

  • Pingback: Sunday Resource Round-up | Type and Tape()

  • Great post! I am going to implement it ASAP.

  • Pingback: Weekly Social Media Review: Google+ and Facebook News Face Off @ GRAFIKDOTCOM()

  • I can understand the amount of efforts and time you have spent to write this ‘Great’ post. Thanks a lot for this valuable information.

  • I just paid $22.87 for an iPad2-64GB and my girlfriend loves her Panasonic Lumix GF 1 Camera that we got for $38.76 there arriving tomorrow by UPS. I will never pay such expensive retail prices in stores again. Especially when I also sold a 40 inch LED TV to my boss for $675 which only cost me $62.81 to buy. Here is the website we use to get it all from,

  • Third-party buttons — aka WordPress plugins — generate the code. However, as I describe in this post, the Facebook Social Plugin code needs the call to the JavaScript function “_ga.trackFacebook” and if your third-party button doesn’t include this, then you won’t get the Google Analytics tracking.This is why I say that you have to hand-code this for your self-hosted WordPress site or blog rather than use a social-button plugin UNLESS that plugin includes a call to activate the GA tracking.I hope this helps!

  • Oscar Iyanez

    Excellent job. Very easy to learn. I´m interesting in all this stuff about google analytics and your web will be good reference to me . Thanks a lot

  • Eve

    This is a great article, easy to understand and follow.
    I have the FB tracking working perfectly, but am having issues with the Twitter tracking. I have placed the tracking code in the section, and the Tweet button code in the of the page.
    I have tested the Tweet button myself, and asked another person to do so, but the results are not showing up in my Analytics Social section (I am definitely viewing the New Version as I can see the FB actions)
    What else should I check?

  • I don’t know how you can integrate AddThis into Google Analytics. AddThis is a widget that generates its own code. It would have to integrate the GA tracking JavaScript in order to have it be tracked.

  • Pingback: Google Analytics Resources. Roundup from DesignFloat | DesignFloat Blog()

  • CaseyWarren95628715

    I just paid $22.87 for an iPad2-64GB and my girlfriend loves her Panasonic Lumix GF 1 Camera that we got for $38.76 there arriving tomorrow by UPS. I will never pay such expensive retail prices in stores again. Especially when I also sold a 40 inch LED TV to my boss for $675 which only cost me $62.81 to buy. Here is the website we use to get it all from,

  • Aaron, 
    I wrestled with this most of today and finally figured out that I needed to leave the reference to widgets.js out on the generated tweet button code.  So the reference to only exists in the asynchronous chunk right before the closing

    Hope it helps

  • hal spencer

    good tips here. It helps 1 week after I inserted some of these buttons manually. I wonder how it can be used with Piwik as some sites are not using GA

  • Ivo

    Lisa & Boben – not sure if you’ll see this, but Facebook gives you 2 ways to use their like button: 1. Through an iFrame and 2. through the .

    Looks like you’re using the iFrame option. When you customize your like button, at the end click on “Generate/Get Code” and select the second type of code of the two (you’ll see the tag)

  • Ivo

    Tim – quick question. My website doesn’t utilize a standard header file that is the same across all pages, but it does have a footer that is the same on all pages. Could I place the Twitter analytics code in my footer instead of the header? I know it won’t be in the tags that way but how much does it matter?

    I just don’t want to have to open every single page I have and insert that code in the will take forever. Thanks!

  • Ivo, It might work to put the tag in your footer, as it’s asynchronous. My suggestion is to test to find out for sure.

  • jzhaoc

    good tips, there are also other services available which can automatically can track all the click on the webpage without setting up tracking for each component, like twitter and facebook button, check this out

  • Pingback: Google Analytics & Facebook Domain Insights Website Social Tracking | HyperArts()

  • Pingback: B2B Web Strategy » At last… you can track traffic from social media in Analytics()

  • tester

    “Add the above code before the tag:”

    Do you mean before tag?

  • Pingback: Tips Tuesday and Taking a Break is a Good Thing()

  • Pingback: Google Analytics Social Tracking – Likes & Unlikes Bug? | HyperArts()

  • No. Add it before the opening tag. Sorry if that wasn’t clear!

  • Thank your for your informative, clear and concise guide of implementing the Social Interaction Analytics for Facebook Social Plugins. This article is very helpful for newbies like me. 

    That said, I do have some questions requiring yr advice. I’ve added the Facebook script asynchronously,  as I implement multiple facebook XFBML buttons throughout my blog, (if I may) you can have a peek at my blog Since the example you’ve used in this guide mentions adding the “extra” analytics script within the “standard” Facebook Like button implementation,


    I would like to ask if this would somehow be different for my case? Thanks in advance

    Basically, here is the sample of the code I applied:

    window.fbAsyncInit = function() {FB.init({appId: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',status: true, // check login statuscookie: true, // enable cookies to allow the server to access the  sessionxfbml: true// parse XFBML});};(function() {var e = document.createElement('script');e.src = document.location.protocol +   '//';e.async = true;document.getElementById('fb-root').appendChild(e);}());

  • Pingback: Tracking Your Social Media Activity with Analytics()

  • Pingback: In case you missed it… Weekly favorites (Aug 15-21) | Adventures in Freelance Translation by Lingua Greca()

  • Hi, 

    Very nice tutorial! Do you know if appId also is optional when loading your like button with asynchronous js ? Like in this example:!

  • Pingback: Hot Google+ Tips for Freelancers()

  • Great post Tim – did you ever write up the post about hand coding in wordpress? I’m using the Google Analyticator plugin – any idea if it uses the new GA code or old? Trying to figure out if all I need to do is add the social tracking code to my buttons or if I need to find a new GA plugin or manually code it all.

  • Pingback: Hot Google+ Tips for Freelancers – Your online guide for finding a job()

  • Anyone else having problems tracking Retweets (twitter shares) using the method described above? I can now see the FB likes/unlikes/comments and +1 data in my Google Analytics social section, but I’m not seeing anything Twitter-related. Any thoughts?

  • Pingback: Add Google Analytics Social Tracking to WordPress Website or Blog | HyperArts()

  • Pingback: Social media measurement and tracking - a giant leap?()

  • Pingback: Need to keep track of your social activity? Google Analytics may have the answer | Kurtosys Blog()

  • My website has randomly slowed down since adding the tracking script from  The browser just hangs until it loads…I downloaded a copy of it and put it on my server to avoid those issues.  Google’s scripts always load fine but must get overloaded…

  • Pingback: 50 Google Analytics Resources - The 2011 Edition()

  • Pingback: One giant leap for social media tracking? | IGNITE()

  • Hicham

    Have the same problem, I am uploading the JS script to my serve now

  • Pingback: Article « OCVMobile Demo Blog()

  • Parthosarathi Goswami

    “Engagement: You see two metrics: 1) Not Socially
    Engaged and 2) Socially Engaged. This shows you how effectively each
    page is in motivating users to Like or Tweet your content:”

    I’ve not found the  “Socially Engaged” sector. How do I set it? Please advice.

  • Thx! Thats really helpfull! And a awesome step from google – waited for this to be posibble. Greats from Austria!

  • Pingback: Great Artilce in Google Anayltics | Local Search Agents Blog()

  • Pingback: Great Artilce in Google Anayltics « Charlie Slacks Blog()

  • Pingback: Use Google Analytics to track social media buttons | BLOGSPOT TEMPLATES()

  • Pingback: Use Google Analytics to track social media buttons | WORDPRESS PORTAL()

  • MtK

    a few weeks after, and I still can’t see any social tacking 🙁

  • MtK

    a few weeks after, and I still can’t see any social tacking 🙁

  • Jason


    Added this onto my site and it’s still not working. The socialtracking.js file it says that this code won’t work if you use the asynchronous method to load scripts, yet you’re loading in the analytics code asynchronously??

    * Helper method to track social features. This assumes all the social
    * scripts / apis are loaded synchronously. If they are loaded async,
    * you might need to add the nextwork specific tracking call to the
    * a callback once the network’s script has loaded.Some help would be really appreciated from anyone that’s managed to get this to work.Regards, Jason

  • Raqwilliams

    Hi, I followed your instructions on putting the code in the right place but I keep getting the response WARNING: Your HTML contains some tags that are not permitted. These have been
    removed from your changes. What I’m I doing wrong? Please help

  • Pingback: Tracking social media activity on and off your website | RER Group()

  • charlieussery

    Hi Tim –

    I have the code setup for my client..but I was wondering if he’s able to see who liked his website (external website with like button on it) I’m assuming he won’t be able see who liked his website like you can see who liked you facebook fan page?

  • Pingback: Tracking social media activity on and off your website | Robert Butler()

  • Pingback: and more! - Diet and Exercises – Diet and Exercises()

  • Pingback: The Democratization of the API « Michael Curry: Information Explosion()

  • Joe Miller

    Has anybody got this working with the “likebox” social plug-in, I can get it to work with the simple like button only

  • Sujitht

    Hi Tim,
    will the facebook button tracking also work with the iframe version of the button?

  • Pingback: Google Analytics Resource Guide – Tips to Make You an Analytics Pro()

  • Rabia Sultan

    Hi Tim!! I want auto-tweet of what people read on my blogger blog, after they connect.
    How can I do this???

  • Thanks for a great post

  • Jolly

    Thanks Tim, but are the ‘original’ tweet and like buttons the built-in one from e.g., Blogger? So we can’t use AddThis for this, right? Just want to clarify.

  • Madhesh

    The article was very useful, Tim. But do we have something to track the shares on Facebook.

  • Madhesh

    The article was very useful, Tim. But do we have something to track the shares on Facebook.

  • Pingback: Can Google Analytics Diversify Your Marketing? | Google Analytics | Education Marketing()

  • Awesome guide, very clean and to the point. Nice work 🙂

  • Pingback: Google Analytics | Social media related content.()

  • Hello!
    Nice post!
    In my blog I described how to add Google +1 Button to every WordPress blog post in respect to iNove theme. I added the +1 button manually editing php files. Probably, it could be useful for someone. The article is here – WordPress: How to add Google +1 Button to WordPress blog post.

  • Jsimonoff

    Tim, these instructions made it easy to get tracking to work with Twitter, but for some reason it isn’t working for FB Likes.  I’m checking the network tab in Chrome developer tools, and, with Twitter, I see the _utm.gif object to by, but it never happens for Like.

    I’m at a loss how to figure out what the problem might be. I’ve got the code exactly as you say, and I’m not getting any JavaScript console errors.  Do you (or anyone) have any suggestions how to debug this?

  • Ircone

    Sujitht, unlikely.  IFRAMES don’t allow the onclick interrupt from the parent DOM.

  • Ircone

    I’m having trouble, too.  I’m betting that Facebook changed something…  Google’s instructions look WAY different than what is described in Tim’s post here.

    Going to try implementing as Google suggests and see if that works.

  • Nice post Tim. I agree that social sharing data is very important to track and measure as social provides content marketing distribution and ROI, both directly and through enhanced rankings in the search results, especially with the latest Google update, Search, Plus Your World. Thanks for the detailed instructions for adding facebook and twitter buttons and how to track. I am also going to take a look at the WordPress social tracking plugin you reference at the end of your post for use on the eBiz ROI blog. Happy Internet Marketing!

  • Thank you friend. this is awesome. I have practiced this. Friends… is that fine if I change it with _ga.trackSocial ?

  • Kabir2880

    Fantastic. You are doing a great job bro!!!!!!!

  • Now that G+ has 100 million members and social shares [ FB likes, RT’s, +1’s ] is having a much greater impact on SEO this article [penned 6 months ago] shows that your radar is working better than most Tim!

    The good news is your excellent 1-2-3 How To article details what’s needed to track a site’s social share activity. The bad news is the majority of my sites and my SMB clients are using widgets to display Likes, +1 & RT’s.

    The social media tracking plugin sounds like it might be adequate to get the job done, else I’ll have to bone up on my how to insert java script code before the code routine. Strong work Tim!

  • Great infos! Do you know if the same exists for the Tumblr Share button (installed on a WordPress blog).

  • JZ Hunter

    I am new to all these and having hard time to create my website using Google free website creator with FB, Twitt, and other social media buttons included.  The main problem is that it does not allow the user to modify the page source code (opens it as read only, at least in my case).  However, it has “Apps Scripts” option and when I click on it, a page with untitled project name opens allowing the user to type scripts; do you know if this is the same as copy and past the code in the HTML file for the page?  does anyone know a good source of information that has step by step instructions how to create a good website on Google and include all the social media buttons and Analytics in it?  Any help will be appreciated.   

  • Fine article.

    I tried to solve the same problem and here is a result: I is working also for Like buttons.

  • Pingback: 4 Hot Analytic Trends That Are Effective And Profitable()

  • Currently i have a site that Tracks Google adwords when you go directly to google adwords website, but if you go through the “newer google analytics” it will not show the tracking.  How do i get all of the Google adwords campaigns from the old adwords site to the NEW google analytics site as well as track the organic traffic, but still be able to differentiate between the ADWORDS and the ORGANIC traffic. THANKS A TON>

  • Pingback: Google Analytics social engagement reports announced - Metricks Web Analytics Brisbane()

  • hzscorpion

    Has anyone been able to successfully implement google analytics to their facebook, twitter, and blog pages?  I have already joined google analytics and created the script/code.  However, I am new to HTML and not sure how on my pages I can modify HTML/FBML/iFrame files to add the script/code.  

    If you have done it, please let me know how or point me to the right website to find the step by step instruction.  

  • hzscorpion

    Have you succeeded to implement the script in HTML/FBML/iFrame for your pages?  I have google analytics  account and have the code to insert in the source files, but not sure how I can access the HTML files to copy and past the code.  Where on your pages do you find them and how do you modify and save changes?  Do you know? Or a resource who shows how?  I have followed all the instructions that I could find on Internet (e.g. websites like this one, youtube, etc.) but none of them has worked so far.  

  • Pingback: Five Minute Marketing Tasks to Improve Your Business Now!()

  • Tracking the “social shares” on your websites accomplishes a couple of important data points. 1) you verify the social signals your site is generating, which in turn will validate you are monitoring the correct SMM sites your prospects / clients are active on 2) you can easily check where your social shares are having the greatest impact for building mind share with your target audience.

  • hzscorpion

    As I have asked few times already, I am trying to use google analytics (GA) that has not worked for me yet.  I am looking for the information how I can add the java code created in my GA account to HTML, FBML, and iFrame for my pages.  I am not in social media business but would like to track likes, friends, page views, and followers on my personal social media.  The info on internet shows everything but how to modify the source files on my pages (where to find them and how access them),  Anyone? 

  • Pingback: How to Track Social Media Traffic With Google Analytics | Jo Shaer Social Media Solutions()

  • Pingback: How to Track Social Media Traffic With Google Analytics | Kendell Lang – Social Media Marketing Guru()

  • Michael Walker

    Hi thanks for the article – have there been any changes to the way one has to do this ?
    Then if one is sharing an article or the site is using the share – this article on Facebook function, would one use the social method or would one create a virtual page view ?

    All the documentation which is still sparse on this only address’s the ‘like’ or +Google buttons which is slightly different to the share method. 


  • Pingback: 10 Tips to Improve Your Business’ Social Media Presence | Grasshopper Blog()

  • Very informative article! I will try.  The llustration is pretty. I’ve pinned.  Thank you.

  • James Sacci

    Thanks for the easy to understand directions on where to place the code. Google Help was a bit confusing.

  • Pingback: So you want to track Social Media traffic? « JMG – SMPR()

  • Pingback: Adding Social Media Share Buttons in WordPress – HTML and CSS()

  • Thank you Tim for the very informative article. It helped me a lot integrating the social tracking w/ Google Analytics. I have one issue though (I use the Google Chrome Analytics Debugger):

    With facebook-likes, the “Social Action URL” is the SEF-pretty URL. With twitter, they are just the “/?p=[article_id]”. How could I change this? I want to see how many likes / tweets a certain article of my wordpress(.org)-blog gets, but I guess it’s dificult if they have different action-url shown in the analytics-report.

  • Pingback: The usage of Google Analytics &a distant Fb Area Insights to trace Social Movements to your Site «

  • i don’t know google analytics could do that. this is very helpful article. thanks

  • Thanks Tim! Very good article. We use Omniture for tracking though… is there any method that will work for us?

    The social plugins tell you how many people like, tweet or plused something, but not necessarily specifically from that page, that is the kind of data I am wanting to get, and Im not sure how to accomplish it.

  • Pingback: Are you tracking social shares with Google Analytics? - Placement Edge()

  • Pingback: WARNING — Trackers are on this Site « Simon Krauss, Privacy Eye()

  • Pingback: How SEMs Can Recognize & Resist Google-Think()

  • Pingback: How SEMs Can Recognize & Resist Google-Think | ClicketyClick()

  • Wow! I really love this article. It has really helped me tracking social networks in analytics. Just like all your other articles this was explained in detail so that a lay man like me can understand it easily. Thanks

  • The thing with Google is that you need to add coding to have it word properly and most of us are not good at this, i would recommend and , both are really good

  • ghost7

    Hi Tim,

    Thanks for the great post. I know you wrote this just over a year but is this info still accurate or has there been any changes strictly to facebook and twitter only?


  • David Nielsen

    There is also an easier way to track your clicks or downloads in Google Analytics. Use , they offer direct click tracking in Google Analytics without the need to change any codings of your website.


  • Stephenkamenar doesn’t work anymore, 404. Where are we supposed to get that code from?

  • Pingback: Optimizing Social Media Presence For Personal Branding()

  • Pingback: Google Analytics – Tracking Facebook « Web Code Basics()

  • Pingback: ABC’s of tracking your social media | Take Me To Your Leader()

  • David James

    Hi Tim,
    Been a long time since anyone posted here so I hope you get this?
    Is this code still applicable October 2013.. I’m using Universal tracking. You mentioned this is asynchronous. I get the Like functionality but nothing showing up under my Social -> Plugin in Analytics after follow the code step by step.

  • Pingback: Advanced Analytics for Measuring Social Media()

  • Prafulla Amrutkar

    Hello gr8 people

    I want to like my webpage(personal website) from any visitors facebook account.
    Is it possible or not?
    if possible so say what is the way to done?

  • Rajeev Mansukhani

    Great Tutorial. I have a question…. Ideally I would want a single interface in google analytics to report entire social activity. The like, share, tweet, retweet, all on one dashboard. Google Analytics is claiming to track all activity on twitter. Twitter had Twitter Analytics for paid users. Now they has it open to all. I am wondering if google analytics could track it anyways, then why would they have it paid in the first place. And why do they open it up to all users when after the google twitter deal revived, google analytics would be able to track each activity anyways. Twitter seems to be in a constant search of a revenue stream to a point where they would want to enforce
    USD 1 / year for the blue checkmark to your twitter account. Even though I believe this is a great way to segregate the regulars from the inactive accounts, I believe it is a desperate move to improve revenue stream. Even though this discussion is not about twitter revenue stream, do you think that the google twitter deal would quickly improve accessibility into twitter activity and therefore make twitter analytics irrelevant….

  • Jessica Bond

    I have been unable to find up-to-date clear instructions on how to track activity using Google Analytics and the new Facebook Page Plugin. Does anyone have any good examples or resources that they can point me towards?

  • Deepa Rani

    sir i want to do like this , but i am not sucess..
    i have js for right sidebar like social media site. but not show number of like on fb cursor.

  • Kaye

    hi sir, i just have a question that is quite related to this article. I have a website and I am changing the URL’s of my articles for SEO purposes. But after the changes, the Google Analytics count for the article resets.

    So if I change the URL, does it mean that the analytics will also be back to 0?

    Thanks 🙂