Custom Variables with Facebook - How to?


(joey001) #1

Hi,

I am wondering how to use a custom variable with the Facebook “Like!”-Button…? Where do I have to write the
piwikTracker.setCustomVariable(1, Facebook, Like) ?


<script type="text/javascript"><!--
  window.fbAsyncInit = function() {
    FB.init({appId: 'your app id', status: true, cookie: true,
             xfbml: true});
  };
  (function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
      '//connect.facebook.net/de_DE/all.js';
    document.getElementById('fb-root').appendChild(e);
  }());
  
document.write("<fb:like show_faces='false' ");
document.write("href='");
document.write(location.href);
document.write("' font='arial'>");
document.write(" </fb:like>");
// --></script>

Thx & Greetings,
Joe


(Peterbo) #2

Hey Joe,

this will not be too simple, because FBML is injecting an iFrame with the Like / Share-Button / widgets, etc. You can’t track events that are triggered within the iframe. You could trigger an event if somebody clicks on the div, where the facebook widget was injected, but i don’t know, how accurate this would be.

Cheers
Peter