Re: reporting.js

From disqus.com, 5 Days ago, written in JavaScript, viewed 3 times. This paste is a reply to jester.js from disqus.com - view diff
URL https://pastebin.freepbx.org/view/1750c716 Embed
Download Paste or View Raw
  1. define('core/analytics/reporting',['require','core/utils/collection/each','core/utils/url/serialize','core/config/urls'],function (require) {
  2.     'use strict';
  3.  
  4.     var each = require('core/utils/collection/each');
  5.     var serialize = require('core/utils/url/serialize');
  6.  
  7.     var urls = require('core/config/urls');
  8.  
  9.     var jesterUrl = urls.jester;
  10.  
  11.     function getLoaderVersionFromUrl(url) {
  12.         var parts = url.split('.');
  13.         var version = parts.length > 2 ? parts[parts.length - 2] : '';  // eslint-disable-line no-magic-numbers
  14.         return version.match(/^[0-9a-f]{32}$/i) && version;
  15.     }
  16.  
  17.     function logStat(eventName) {
  18.         new window.Image().src = serialize(jesterUrl + '/stat.gif', { event: eventName });
  19.     }
  20.  
  21.     function reportJester(payload) {
  22.         new window.Image().src = serialize(jesterUrl + '/event.gif', payload);
  23.     }
  24.  
  25.     function reportJesterPOST(payload) {
  26.         var data = new window.URLSearchParams();
  27.         each(payload, function (value, key) {
  28.             if (value !== undefined) {
  29.                 data.append(key, value);
  30.             }
  31.         });
  32.         var req = new window.XMLHttpRequest();
  33.         req.open('POST', jesterUrl + '/event.json', true);
  34.         req.withCredentials = true;
  35.         req.send(data);
  36.     }
  37.  
  38.     return {
  39.         getLoaderVersionFromUrl: getLoaderVersionFromUrl,
  40.         logStat: logStat,
  41.         reportJester: reportJester,
  42.         reportJesterPOST: reportJesterPOST,
  43.     };
  44. });
  45.  
  46. // https://c.disquscdn.com/next/next-core/core/analytics/reporting.js

Replies to Re: reporting.js rss

Title Name Language When
BaseApp.js disqus.com javascript 5 Days ago.

Reply to "Re: reporting.js"

Here you can reply to the paste above