Warning: Use of undefined constant WPRBLVERSION - assumed 'WPRBLVERSION' (this will throw an Error in a future version of PHP) in /home/abbysims/public_html/wp-content/plugins/wp-render-blogroll-links/WP-Render-Blogroll.php on line 19

Warning: Cannot modify header information - headers already sent by (output started at /home/abbysims/public_html/wp-content/plugins/wp-render-blogroll-links/WP-Render-Blogroll.php:19) in /home/abbysims/public_html/wp-content/plugins/sg-cachepress/core/Supercacher/Supercacher_Helper.php on line 46
2011 | Abby Sims - the web site

Archive - 2011

Tracking like button click events

Tracking like button click events

Sometimes, you want to track certain Facebook interactions within your internal analytic tools. Below is code to detect like, unlike, and send message clicks for the Facebook Like Button social plugin. This logs to Google Analytics. Just add the following event subscriptions between some Javascript tags after the Facebook JS SDK has been loaded. “response” is the URL that was liked or sent. Adjust what happens for each event, as desired.

       FB.Event.subscribe('edge.create', function (response) {
            _gaq.push(['_trackEvent', 'Something', 'Like', response]);
        FB.Event.subscribe('edge.remove', function (response) {
            _gaq.push(['_trackEvent', 'Something', 'Un-Like', response]);
        FB.Event.subscribe('message.send', function (response) {
            _gaq.push(['_trackEvent', 'Something', 'Comment', response]);

Copyright © 2016, Abby Sims