Shoora
5/13/2019 - 4:24 AM

ga-social-tracking

ga-social-tracking

    <script>
    function zwf_ga_st_callback(arr_params) {
        console.log(arr_params);
        alert(arr_params);
    }
    </script>
/*! ga-social-tracking-js; build: v1.0-1-g441a21-dirty; http://zytzagoo.github.io/ga-social-tracking-js/ */
var e = {};
e.extract_param_from_uri = function(e, t) {
  if (e) {
    var a = new RegExp("[\\?&#]" + t + "=([^&#]*)"),
      r = a.exec(e);
    return null !== r ? unescape(r[1]) : void 0
  }
}, e.ga_send = function(e) {
  try {
    _gaq.push(e)
  } catch (t) {
    if ("function" != typeof window.ga) throw "No usable GA implementation found";
    e[0] = "social", e.unshift("send"), window.ga.apply(window, e)
  }
  "function" == typeof zwf_ga_st_callback && zwf_ga_st_callback.call(this, e)
}, 
e.track_twitter = function(t) {
  if (t) {
    var a = t.type;
    switch (t.type) {
      case "click":
        t.region && (a = t.region);
        break;
      case "retweet":
        t.data.source_tweet_id && (a = t.data.source_tweet_id);
        break;
      case "favorite":
        t.data.source_tweet_id && (a = t.data.source_tweet_id), t.data.tweet_id && (a = t.data.tweet_id);
        break;
      case "follow":
        t.data && t.data.user_id && t.data.screen_name && (a = t.data.user_id + " (" + t.data.screen_name + ")")
    }
    if (t.target && "IFRAME" == t.target.nodeName) {
      var r = e.extract_param_from_uri(t.target.src, "url");
      r && (a += " - " + r)
    }
    var c = ["_trackSocial", "Twitter", t.type];
    c.push(a), e.ga_send(c)
  }
}, e.track_facebook = function(t, a) {
  var r = ["_trackSocial", "Facebook", t, a];
  e.ga_send(r)
};
try {
  FB && FB.Event && FB.Event.subscribe && (FB.Event.subscribe("edge.create", function(t) {
    e.track_facebook("like", t)
  }), FB.Event.subscribe("edge.remove", function(t) {
    e.track_facebook("unlike", t)
  }), FB.Event.subscribe("message.send", function(t) {
    e.track_facebook("send", t)
  }))
} catch (t) {}
"undefined" != typeof twttr && twttr.ready(function(t) {
  for (var a = ["tweet", "follow", "retweet", "favorite", "click"], r = 0, c = a.length; c > r; r++) {
    var n = a[r];
    t.events.bind(n, e.track_twitter)
  }
});