GA.prototype.loadClassic = function (callback) {
  if (this.options.doubleClick) {
    load('//stats.g.doubleclick.net/dc.js', callback);
  } else {
    load({
      http: 'http://www.google-analytics.com/ga.js',
      https: 'https://ssl.google-analytics.com/ga.js'
    }, callback);
  }
};
Beispiel #2
0
exports.load = function(opts, fn){
  if ('function' == typeof opts) {
    fn = opts;
    opts = {};
  }

  type = opts.type || 'iframe'; // or 'flash'

  if ('flash' == type) {
    script('http://www.youtube.com/apiplayer?enablejsapi=1&version=3', fn, 'onYouTubePlayerReady');
  } else {
    script('https://www.youtube.com/iframe_api', fn, 'onYouTubeIframeAPIReady');
  }
};
Beispiel #3
0
  function load (callback) {
    if (isAlreadyLoaded() || isLoaded) {
      return callback && callback(undefined, window[global]);
    }

    callback && onReady.subscribe(callback);

    if (isLoading) return;

    isLoading = true;

    if (!url) return;

    loadScript(url, function (error) {
      if (hasManualTrigger) return;

      if (error) {
        isLoaded = true;
        return onReady.publish(error);
      }

      trigger();
    });

  };
WebEngage.prototype.load = function(fn){
  var path = '/js/widget/webengage-min-v-4.0.js';
  load({
    https: 'https://ssl.widgets.webengage.com' + path,
    http: 'http://cdn.widgets.webengage.com' + path
  }, fn);
};
Beispiel #5
0
  initialize : function (options, ready) {
    window._ufq = window._ufq || [];
    load('//d2y71mjhnajxcg.cloudfront.net/js/userfox-stable.js');

    // userfox creates its own queue, so we're ready right away
    ready();
  },
Beispiel #6
0
 value: function componentDidMount() {
   if (!this.props.isScriptLoaded) {
     loadScript(this.props.scriptUrl, this.onLoad);
   } else {
     this.onLoad();
   }
 },
Beispiel #7
0
  initialize : function (options, ready) {

    // ClickTale wants this at the "top" of the page. The
    // analytics.js snippet sets this date synchronously now,
    // and  makes it available via load-date.
    window.WRInitTime = date.getTime();


    // Make the `<div>` element and insert it at the end of the body.
    var createClickTaleDiv = function () {
      // loop until the body is actually available
      if (!document.body) return setTimeout(createClickTaleDiv, 5);

      var div = document.createElement('div');
      div.setAttribute('id', 'ClickTaleDiv');
      div.setAttribute('style', 'display: none;');
      document.body.appendChild(div);
    };
    createClickTaleDiv();

    var onloaded = function () {
      window.ClickTale(options.projectId, options.recordingRatio, options.partitionId);
      ready();
    };

    // Load the appropriate CDN library, if no
    // ssl library is provided and we're on ssl then
    // we can't load anything (always true for non-premium accounts.)
    load({
      http  : options.httpCdnUrl,
      https : options.httpsCdnUrl
    }, onloaded);
  },
Beispiel #8
0
 onBody(function () {
   window._sf_endpt = new Date().getTime();
   load({
     https: 'https://a248.e.akamai.net/chartbeat.download.akamai.com/102508/js/chartbeat.js',
     http: 'http://static.chartbeat.com/js/chartbeat.js'
   }, ready);
 });
Beispiel #9
0
Pingdom.prototype.initialize = function (options, ready) {
  window._prum = [
    ['id', options.id],
    ['mark', 'firstbyte', date.getTime()]
  ];
  load('//rum-static.pingdom.net/prum.min.js', ready);
};
Beispiel #10
0
export function fb(callback) {
  if (!canUseDOM) {
    return;
  } else if (initialized) {
    callback(window.FB);
  } else {
    queue.push(callback);
    if (!window.fbAsyncInit) {
      // https://developers.facebook.com/docs/javascript/reference/FB.init
      window.fbAsyncInit = () => {
        window.FB.init({
          appId: window.config.facebook.appId,
          autoLogAppEvents: true,
          status: true,
          cookie: true,
          xfbml: false,
          version: 'v3.2',
        });
        initialized = true;
        queue.forEach(cb => cb(window.FB));
        queue = null;
      };
      const isDebug = window.localStorage.getItem('fb:debug') === 'true';
      loadScript(`https://connect.facebook.net/en_US/sdk/xfbml.customerchat${isDebug ? '/debug' : ''}.js`, { async: true }); // prettier-ignore
    }
  }
}
Beispiel #11
0
UserVoice.prototype.initializeClassic = function (options, ready) {
  window.UserVoice || (window.UserVoice = []);
  window.showClassicWidget = showClassicWidget; // part of public api
  if (options.showWidget) showClassicWidget('showTab', formatClassicOptions(options));
  callback.async(ready);
  load('//widget.uservoice.com/' + options.apiKey + '.js');
};
Beispiel #12
0
Tapstream.prototype.initialize = function (options, ready) {
  window._tsq = window._tsq || [];
  window._tsq.push(['setAccountName', options.accountName]);
  if (options.initialPageview) this.pageview();
  load('//cdn.tapstream.com/static/js/tapstream.js');
  ready();
};
Beispiel #13
0
  initialize : function (options, ready) {
    window.UserVoice = window.UserVoice || [];
    load('//widget.uservoice.com/' + options.widgetId + '.js', ready);

    var optionsClone = clone(options);
    alias(optionsClone, {
      'forumId'         : 'forum_id',
      'primaryColor'    : 'primary_color',
      'linkColor'       : 'link_color',
      'defaultMode'     : 'default_mode',
      'supportTabName'  : 'support_tab_name',
      'feedbackTabName' : 'feedback_tab_name',
      'tabLabel'        : 'tab_label',
      'tabColor'        : 'tab_color',
      'tabPosition'     : 'tab_position',
      'tabInverted'     : 'tab_inverted'
    });

    // If we don't automatically show the tab, let them show it via 
    // javascript. This is the default name for the function in their snippet.
    window.showClassicWidget = function (showWhat) {
      window.UserVoice.push([showWhat || 'showLightbox', 'classic_widget', optionsClone]);
    };

    // If we *do* automatically show the tab, get on with it!
    if (options.showTab) {
      window.showClassicWidget('showTab');
    }
  }
Beispiel #14
0
  initialize : function (options, ready) {
    window._learnq = window._learnq || [];
    window._learnq.push(['account', options.apiKey]);
    load('//a.klaviyo.com/media/js/learnmarklet.js');

    // Klaviyo creats a queue, so it's ready immediately.
    ready();
  },
Curebit.prototype.load = function(fn){
  var url = '//d2jjzw81hqbuqv.cloudfront.net/integration/curebit-1.0.min.js';
  var tags = this.campaignTags();
  if (!tags.length)
    load(url, fn);
  else
    this.injectIntoId(url, this.options.insertIntoId, fn);
};
Beispiel #16
0
  initialize : function (options, ready) {
    var _fxm = window._fxm || {};
    window._fxm = _fxm.events || [];
    load('//d35tca7vmefkrc.cloudfront.net/scripts/' + options.appId + '.js');

    // FoxMetrics makes a queue, so it's ready immediately.
    ready();
  },
Beispiel #17
0
  initialize : function (options, ready) {
    window._uc = window._uc || [];
    window._uc.push(['_key', options.key]);
    load('//api.usercycle.com/javascripts/track.js');

    // USERcycle makes a queue, so it's ready immediately.
    ready();
  },
Beispiel #18
0
Errorception.prototype.initialize = function (options, ready) {
  window._errs = [options.projectId];
  onError(function() {
    window._errs.push(arguments);
  });
  load('//beacon.errorception.com/' + options.projectId + '.js');
  callback.async(ready);
};
Beispiel #19
0
  initialize : function (options, ready) {

    window._prum = [['id', '5168f8c6abe53db732000000'],
                 ['mark', 'firstbyte', date.getTime()]];

    // We've replaced the original snippet loader with our own load method.
    load('//rum-static.pingdom.net/prum.min.js', ready);
  }
Qualaroo.prototype.load = function(fn){
  var token = this.options.siteToken;
  var id = this.options.customerId;
  var loaded = bind(this, this.loaded);
  load('//s3.amazonaws.com/ki.js/' + id + '/' + token + '.js', function(){
    when(loaded, fn);
  });
};
Beispiel #21
0
  initialize : function (options, ready) {
    window._veroq = window._veroq || [];
    window._veroq.push(['init', { api_key: options.apiKey }]);
    load('//www.getvero.com/assets/m.js');

    // Vero creates a queue, so it's ready immediately.
    ready();
  },
LiveChat.prototype.load = function (callback) {
  var self = this;
  load('//cdn.livechatinc.com/tracking.js', function(err){
    if (err) return callback(err);
    self.isLoaded = true;
    callback();
  });
};
Beispiel #23
0
 initialize : function (options, ready) {
   window._comscore = window._comscore || [];
   window._comscore.push(options);
   load({
     http  : 'http://b.scorecardresearch.com/beacon.js',
     https : 'https://sb.scorecardresearch.com/beacon.js'
   }, ready);
 }
Beispiel #24
0
 initialize : function (options, ready) {
   window._qevents = window._qevents || [];
   window._qevents.push({ qacct: options.pCode });
   load({
     http  : 'http://edge.quantserve.com/quant.js',
     https : 'https://secure.quantserve.com/quant.js'
   }, ready);
 }
Beispiel #25
0
  initialize : function (options, ready) {
    window._sbq = window._sbq || [];
    window._sbk = options.apiKey;
    load('//storyberg.com/analytics.js');

    // Storyberg creates a queue, so it's ready immediately.
    ready();
  },
Curebit.prototype.load = function(fn){
  var url = '//d2jjzw81hqbuqv.cloudfront.net/assets/api/all-0.6.js';
  var tags = this.campaignTags();
  if (!tags.length)
    load(url, fn);
  else
    this.injectIntoId(url, this.options.insertIntoId, fn);
};
Beispiel #27
0
module.exports = function(url, fn){
  var id = getId(url);

  window._youtubeFeedCallback = function(json){
    if (fn) fn(json.data);
  };

  loadScript('http://gdata.youtube.com/feeds/api/videos/'+ id +'?v=2&alt=jsonc&callback=_youtubeFeedCallback');
};
LiveChat.prototype.load = function(callback){
  var self = this;
  load('//cdn.livechatinc.com/tracking.js', function(err){
    if (err) return callback(err);
    when(function(){
      return self.loaded();
    }, callback);
  });
};
Beispiel #29
0
Metrica.prototype.initialize = function (options, ready) {
  push(function () {
    var id = options.counterId;
    window['yaCounter' + id] = new window.Ya.Metrika({ id: id });
  });

  ready();
  load('//mc.yandex.ru/metrika/watch.js');
};
MouseStats.prototype.load = function (callback) {
  var number = this.options.accountNumber;
  var path = number.slice(0,1) + '/' + number.slice(1,2) + '/' + number;
  var cache = Math.floor(new Date().getTime() / 60000);
  var partial = '.mousestats.com/js/' + path + '.js?' + cache;
  var http = 'http://www2' + partial;
  var https = 'https://ssl' + partial;
  load({ http: http, https: https }, callback);
};