How to Track Facebook Likes on Your Website with Woopra 1

Today, I’m going to explain how to use Woopra Custom Events to track when visitors like something on your website through the Facebook Like Button.

First of all, you need to use the XFBML script to add the Facebook Like Buttons on your website. If you use the iFrame method, this method will not work. You can grab the code of your button from Facebook.

Now, we need to fire Woopra Custom Event. All you need to do is to insert the following code at the footer of your website:

<!-- Start: Tracking Facebook Like with Woopra -->
<script type="text/javascript">
if (typeof FB != 'undefined') {
    FB.Event.subscribe('edge.create', function(url) {
        woopraTracker.pushEvent({name: 'Facebook Like', url: url});
    });
}
</script>
<!-- End: Tracking Facebook Like with Woopra -->

Note that the code above extends the Woopra code and does NOT replace it. Make sure NOT to remove the Woopra tracking code from your website.

That’s it. Now, you’ll be able to see your visitors liking things on your website in real-time :)

You want more? let’s spice it up by setting up a Label for future analysis (and probably notifications?):

  • Go to Manage > Label.
  • Hit the [ + New] button to create a new Label
  • Let’s call this label: Facebook Fans
  • Set the filter as follows:
    • Custom Event Data
    • Event Key: name
    • Matches Exactly
    • Event Value: Facebook Like
  • Set your preferred color. I’d go for the blue color of Facebook: #6d84b6
  • Enable Notifications and configure as follows:

Now, whenever a user likes something on your website, you’ll get notified like this:

I hope you enjoyed this tutorial.

Elie
Woopra Founder

One comment on “How to Track Facebook Likes on Your Website with Woopra

  1. Reply Sarah S Feb 15,2011 11:06 pm

    Hello, I’m new on here and glad to be a part of the discussion.

Leave a Reply