Unbounce Answers/Next Steps/Social Media & Other Widgets

How to track conversions for a Facebook "like" button [DEPRECATED]

Carter Gilchrist
posted this on August 02, 2011 04:19 pm

IMPORTANT: Unfortunately the script on this article is no longer working to track conversions for Facebook Like buttons that have been manually embedded to landing pages. We understand that tracking different conversion types is important for most of your online campaigns and we would love to hear your feedback in our community forum at GetSatisfaction.

If the goal of your page is to acquire Facebook "likes", then it would make sense that you want to track those as conversions in order to run an A/B test. I've outlined how to get that working below:

  1. Get the Script
    This won't work on the iFrame or HTML5 version of the script, so hop over to the Facebook Developer page and grab the FBML code for your "like" button if you aren't already using it.
     
  2. Add it to your Unbounce Page
    Use the Custom HTML block to add the script to your page by clicking on this icon in the toolbar:

    Screen_shot_2011-08-02_at_4.13.06_PM.png

    and then paste in the XFBML script that you copied from Facebook. It should look like this:

     Screen_shot_2011-08-02_at_4.15.09_PM.png

    Note: You won't be able to add the XML namespace to the <html> tag at this point yet, which might result in this not working properly in older versions of I.E.

  3. Add the tracking script
    Now you'll need to open up the Scripts dialog by clicking this button in the toolbar:

    Screen_shot_2011-08-02_at_4.16.14_PM.png

    and paste in the following script (with the "Placement" set to "Before Body End Tag"):

    <script type="text/javascript">
    FB.Event.subscribe('edge.create', function(response) {
    // This will track a conversion in Unbounce
    jQuery.get('/clkg/http/facebookLike');
    });
    </script>

 

That's all there is to it! You should start to see your conversions go up when the Like button is pressed. 

 

 

Comments

User photo
Kyle Hawke

This is cool. Thanks for sharing. Quick question though... If this only works with the FBML embed code, how do we get the XML namespace (<html xmlns:fb="http://ogp.me/ns/fb#">) in the head tag? Oli said you can't do that back on June 10 (http://support.unbounce.com/entries/307681-adding-a-facebook-widget-using-facebook-s-iframe-code).

November 21, 2011 05:35 pm
User photo
Matthias Förster

We are trying to implement xfbml Facebook like button in our page. But after putting the code for the Java Script together with the code into a html box nothing happens. Also putting the JS in the Script database and juste the code in a html isn't working. How do you did it Carter?

April 18, 2012 02:48 am
User photo
Jacquelyn Ma
Unbounce

Hi Matthias - thanks for your message.

Unfortunately the script on this article is not longer working to track conversions for Facebook Like buttons that have been manually embedded to landing pages. We understand that tracking different conversion types is important for most of your online campaigns and we would love to hear your feedback in our community forum at GetSatisfaction.

However, we do recommend the social widgets tool that is now available in the main Unbounce page editor. Although they cannot tracked as conversions for the page, they are still a great way to enable your users to share your campaign with others. To learn more about social widgets, please visit http://support.unbounce.com/entries/21263181-how-to-add-social-medi...

Please don't hesitate to let us know if you have any further questions regarding this topic.

Cheers,

Jacquelyn | Unbounce Customer Success

May 15, 2012 01:47 pm