.
Social media metrics remain one of the many moving targets in online marketing. How does getting someone to “like” your page or “retweet” your link correlate to more sales or better brand loyalty? What’s the rate of conversion? Or plainly, what difference does it make? By tracking on-site social actions such as Facebook “likes” and Twitter “retweets,” we’ll get a little closer to uncovering social media return on investment (ROI).
Tracking Google +1′s
Google released the Plus One button recently and has seen pretty strong adoption so far especially after the launch of the Google Plus social network. If you’re using this social plug-in, it’s a good idea to track it in whatever analytics platform you’re using. Google is holding off on letting businesses have brand pages on their Google Plus network but that won’t stop customers from discussing your brand on the network so tracking interactions can afford you valuable insight.
Here’s a quick walkthrough of how to do that:
1. Add the Plus One API script
Take this script and simply copy and paste it to the head section of your page:
The head section of your page is generally marked by this bit of html: <head>.
<script src="http://apis.google.com/js/plusone.js" type="text/javascript"></script>
2. Get your button
Create your Plus One widget using Google’s button creation tool to get a code that looks something like this:
<g:plusone size="tall" callback="plusone_vote"></g:plusone>
3. Add your tracking script
Using Google’s API, we can “listen” for any time someone clicks on the Plus One button and alert our analytics platform when it happens:
<script type="text/javascript"> function plusone_vote( obj ) { // Put your custom event-tracking code here } </script>
You can put any event-based tracking script in there and customize it to your heart’s content. If you’re using HubSpot’s middle of the funnel tools, your code will look something like this:
<script type="text/javascript"> var _paq = _paq || []; function plusone_vote( obj ) { _paq.push(["trackConversion", { id: "YOUR_EVENT_ID" }]); } </script>
And that’s it! However, if you’re using Google’s Plus One, you’re probably already up on Facebook’s Like Button, a widget that needs no introduction. Here is a quick walkthrough of how to set that up.
Tracking Facebook Likes
Keep in mind that this only works with the XFBML version of the Facebook Like button. XFBML is the more versatile of the Facebook Like button types but requires the use of Javascript on your site. If you’re currently using the iframe version, you can generate a new version of the code by visiting the Facebook Developer page. Not sure if your site uses Javascript SDK? Drop a note to your webmaster, making this discovery takes only a minute.
1. Add your button code
Your Facebook button code should look something like this:
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http://www.example.com/" show_faces="false" width="450" font=""></fb:like>
2. Add your tracking script
Just like the Google Plus One button, Facebook uses an API to “listen” for when someone likes/dislikes your page. To track that, toss this little snippet of Javascript at the bottom of any page that uses the Facebook Like button:
<script type="text/javascript"> FB.Event.subscribe('edge.create', function(response) { // Put your custom event-tracking script here }); </script>
If you’re a HubSpot customer using our middle of the funnel tools, your script will look something like this:
<script type="text/javascript"> var _paq = _paq || []; FB.Event.subscribe('edge.create', function(response) { // Put your custom event-tracking script here _paq.push(["trackConversion", { id: "YOUR_EVENT_ID" }]); }); </script>
If you want to track “dislikes” too, simply duplicate that block of code and change “edge.create” to “edge.remove” instead. And that’s it! Congrats, you’re now tracking social media engagement on your website!
How has your company used insights from Facebook and Google Plus activity to better your business?