jylamont
7/9/2012 - 6:32 AM

Vero Mixpanel integration

Vero Mixpanel integration

<script type="text/javascript">
  window.mixpanel = (function (a) {
    // This snippet sets up the 'mixpanel' object to be used by Mixpanel.
    a._i=[];a.init=function(b,c,f){function d(a,b){var c=b.split(".");2==c.length&&(a=a[c[0]],b=c[1]);a[b]=function(){a.push([b].concat(Array.prototype.slice.call(arguments,0)))}}var g=a;"undefined"!==typeof f?g=
    a[f]=[]:f="mixpanel";g.people=g.people||[];h="disable track track_pageview track_links track_forms register register_once unregister identify name_tag set_config people.set people.increment".split(" ");for(e=0;e<h.length;e++)d(g,h[e]);a._i.push([b,c,f])};a.__SV=1.1;return a;
  })(window.mixpanel||[]);

  mixpanel.init("TOKEN_ID");

  loadMixpanel = function(c) {
    // This snippet loads Mixpanels javascript library. This will be called either: a) after vero successfully loads or, b) 3 seconds after the page load (if vero fails to load).
    var b,d,h,e;b=c.createElement("script");b.type="text/javascript";b.async=!0;b.src=("https:"===c.location.protocol?"https:":"http:")+'//api.mixpanel.com/site_media/js/api/mixpanel.2.js';d=c.getElementsByTagName("script")[0];d.parentNode.insertBefore(b,d);
  };
</script>

<script type="text/javascript">
  var _veroq = _veroq || [];

  setTimeout(function(){if(typeof window.Semblance=="undefined"){console.log("Vero did not load in time.");for(var i=0;i<_veroq.length;i++){a=_veroq[i];if(a.length==3&&typeof a[2]=="function")a[2](null,false);}}},3000);

  _veroq.push(['init', {
      api_key: 'API_KEY', 
      secret: 'API_SECRET'
    }, function (vero, loaded){ 
      if (loaded)
        window.mixpanel.splice(0, 0, vero.listeners.attach_to_mixpanel)
      loadMixpanel(document); 
    }]
  );
  (function() {var ve = document.createElement('script'); ve.type = 'text/javascript'; ve.async = true; ve.src = '//getvero.com/assets/m.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ve, s);})();
</script>