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); } };
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'); } };
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); };
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(); },
value: function componentDidMount() { if (!this.props.isScriptLoaded) { loadScript(this.props.scriptUrl, this.onLoad); } else { this.onLoad(); } },
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); },
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); });
Pingdom.prototype.initialize = function (options, ready) { window._prum = [ ['id', options.id], ['mark', 'firstbyte', date.getTime()] ]; load('//rum-static.pingdom.net/prum.min.js', ready); };
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 } } }
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'); };
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(); };
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'); } }
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); };
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(); },
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(); },
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); };
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); }); };
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(); }); };
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); }
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); }
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); };
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); }); };
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); };