thatpatguy

LB - Quantcast

Jul 20th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Copyright (c) 2008-2016, Quantcast Corp. */
  2. if (!__qc) {
  3.     var __qc = {
  4.         qs: 'quantserve.com',
  5.         ql: 'quantcount.com',
  6.         pixelcalls: [],
  7.         pmto: null,
  8.         pmc: undefined,
  9.         qcdst: function() {
  10.             if (__qc.qctzoff(0) != __qc.qctzoff(6)) return 1;
  11.             return 0;
  12.         },
  13.         qctzoff: function(m) {
  14.             var d1 = new Date(2000, m, 1, 0, 0, 0, 0);
  15.             var t = d1.toGMTString();
  16.             var d3 = new Date(t.substring(0, t.lastIndexOf(" ") - 1));
  17.             return d1 - d3;
  18.         },
  19.         qceuc: function(s) {
  20.             if (typeof(encodeURIComponent) == 'function') {
  21.                 return encodeURIComponent(s);
  22.             } else {
  23.                 return escape(s);
  24.             }
  25.         },
  26.         qcrnd: function() {
  27.             return Math.round(Math.random() * 2147483647);
  28.         },
  29.         qcgc: function(n) {
  30.             var v = '';
  31.             var c = document.cookie;
  32.             if (!c) return v;
  33.             var i = c.indexOf(n + "=");
  34.             var len = i + n.length + 1;
  35.             if (i > -1) {
  36.                 var end = c.indexOf(";", len);
  37.                 if (end < 0) end = c.length;
  38.                 v = c.substring(len, end);
  39.             }
  40.             return v;
  41.         },
  42.         qcdomain: function() {
  43.             var d = document.domain;
  44.             if (d.substring(0, 4) == "www.") d = d.substring(4, d.length);
  45.             var a = d.split(".");
  46.             var len = a.length;
  47.             if (len < 3) return d;
  48.             var e = a[len - 1];
  49.             if (e.length < 3) return d;
  50.             d = a[len - 2] + "." + a[len - 1];
  51.             return d;
  52.         },
  53.         qhash2: function(h, s) {
  54.             for (var i = 0; i < s.length; i++) {
  55.                 h ^= s.charCodeAt(i);
  56.                 h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24);
  57.             }
  58.             return h;
  59.         },
  60.         qhash: function(s) {
  61.             var h1 = 0x811c9dc5,
  62.                 h2 = 0xc9dc5118;
  63.             var hash1 = __qc.qhash2(h1, s);
  64.             var hash2 = __qc.qhash2(h2, s);
  65.             return (Math.round(Math.abs(hash1 * hash2) / 65536)).toString(16);
  66.         },
  67.         sd: ["4dcfa7079941", "127fdf7967f31", "588ab9292a3f", "32f92b0727e5", "22f9aa38dfd3", "a4abfe8f3e04", "18b66bc1325c", "958e70ea2f28", "bdbf0cb4bbb", "65118a0d557", "40a1d9db1864", "18ae3d985046", "3b26460f55d"],
  68.         qcsc: function() {
  69.             var s = "";
  70.             var d = __qc.qcdomain();
  71.             if (__qc.qad == 1) return ";fpan=u;fpa=";
  72.             var qh = __qc.qhash(d);
  73.             for (var i = 0; i < __qc.sd.length; i++) {
  74.                 if (__qc.sd[i] == qh) return ";fpan=u;fpa=";
  75.             }
  76.             var u = document;
  77.             var da = new Date();
  78.             var t = 33955200000;
  79.             var a = __qc.qcgc("__qca");
  80.             if (a.length > 0) {
  81.                 try {
  82.                     var c = parseInt(a.split('-')[2], 10);
  83.                     if (da - c > t) {
  84.                         u.cookie = "__qca=" + a + "; expires=" + new Date(c + t).toGMTString() + "; path=/; domain=" + d;
  85.                     }
  86.                 } catch (e) {}
  87.                 s += ";fpan=0;fpa=" + a;
  88.             }
  89.             if (__qc.qcgc("__qca").length == 0) {
  90.                 a = 'P0-' + __qc.qcrnd() + '-' + da.getTime();
  91.                 u.cookie = "__qca=" + a + "; expires=" + new Date(da.getTime() + t).toGMTString() + "; path=/; domain=" + d;
  92.                 a = __qc.qcgc("__qca");
  93.                 if (a.length > 0) {
  94.                     s += ";fpan=1;fpa=" + a;
  95.                 } else {
  96.                     s += ";fpan=u;fpa=";
  97.                 }
  98.             }
  99.             return s;
  100.         },
  101.         qcdc: function(n) {
  102.             document.cookie = n + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/; domain=" + __qc.qcdomain();
  103.         },
  104.         qpxload: function(img) {
  105.             if (img && typeof(img.width) == "number" && img.width == 3) {
  106.                 __qc.qcdc("__qca");
  107.             }
  108.         },
  109.         qcdnt: function() {
  110.             var ipf = false;
  111.             if (typeof(window.external) !== 'undefined' && window.external !== null) {
  112.                 var we = window.external;
  113.                 ipf = (typeof we.InPrivateFilteringEnabled === 'function' && we.InPrivateFilteringEnabled() === true);
  114.             }
  115.             return (ipf || navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1");
  116.         },
  117.         qcp: function(p, myqo) {
  118.             var s = '',
  119.                 a = null;
  120.             uh = null;
  121.             var media = 'webpage',
  122.                 event = 'load';
  123.             if (myqo != null) {
  124.                 for (var k in myqo) {
  125.                     if (typeof(k) != 'string') {
  126.                         continue;
  127.                     }
  128.                     if (typeof(myqo[k]) != 'string') {
  129.                         continue;
  130.                     }
  131.                     if (k == 'uid' || k == 'uh') {
  132.                         if (__qc.qcdnt() === false) {
  133.                             uh = __qc.qhash(myqo[k]);
  134.                         }
  135.                         delete myqo[k];
  136.                         continue;
  137.                     }
  138.                     if (k == 'qacct') {
  139.                         a = myqo[k];
  140.                         continue;
  141.                     }
  142.                     s += ';' + k + p + '=' + __qc.qceuc(myqo[k]);
  143.                     if (k == 'media') {
  144.                         media = myqo[k];
  145.                     }
  146.                     if (k == 'event') {
  147.                         event = myqo[k];
  148.                     }
  149.                 }
  150.             }
  151.             if (typeof a != "string") {
  152.                 if ((typeof _qacct == "undefined") || (_qacct.length == 0)) return '';
  153.                 a = _qacct;
  154.             }
  155.             if (typeof uh === 'string') {
  156.                 myqo['uh'] = uh;
  157.                 s += ';uh' + p + '=' + __qc.qceuc(uh);
  158.             }
  159.             if (media == 'webpage' && event == 'load') {
  160.                 for (var i = 0; i < __qc.qpixelsent.length; i++) {
  161.                     if (__qc.qpixelsent[i] == a) return '';
  162.                 }
  163.                 __qc.qpixelsent.push(a);
  164.             }
  165.             if (media == 'ad') {
  166.                 __qc.qad = 1;
  167.             }
  168.             s = ';a' + p + '=' + a + s;
  169.             return s;
  170.         },
  171.         qcesc: function(s) {
  172.             return s.replace(/\./g, '%2E').replace(/,/g, '%2C');
  173.         },
  174.         qcd: function(o) {
  175.             return (typeof(o) != "undefined" && o != null);
  176.         },
  177.         qcogl: function() {
  178.             var m = document.getElementsByTagName('meta');
  179.             var o = '';
  180.             for (var i = 0; i < m.length; i++) {
  181.                 if (o.length >= 1000) return o;
  182.                 if (__qc.qcd(m[i]) && __qc.qcd(m[i].attributes) && __qc.qcd(m[i].attributes.property) && __qc.qcd(m[i].attributes.property.value) && __qc.qcd(m[i].content)) {
  183.                     var p = m[i].attributes.property.value;
  184.                     var c = m[i].content;
  185.                     if (p.length > 3 && p.substring(0, 3) == 'og:') {
  186.                         if (o.length > 0) o += ',';
  187.                         var l = (c.length > 80) ? 80 : c.length;
  188.                         o += __qc.qcesc(p.substring(3, p.length)) + '.' + __qc.qcesc(c.substring(0, l));
  189.                     }
  190.                 }
  191.             }
  192.             return __qc.qceuc(o);
  193.         },
  194.         qchcr: function(e) {
  195.             if (e.source !== window.top) {
  196.                 return;
  197.             }
  198.             var params = null;
  199.             try {
  200.                 params = (typeof JSON === 'object') && JSON.parse(e.data);
  201.             } catch (e) {}
  202.             if (params && typeof params.PrivacyManagerAPI === 'object') {
  203.                 clearTimeout(__qc.pmto);
  204.                 if (window.removeEventListener) {
  205.                     window.removeEventListener('message', __qc.qchcr, false);
  206.                 } else if (window.detachEvent) {
  207.                     window.detachEvent('onmessage', __qc.qchcr);
  208.                 }
  209.                 __qc.pmc = params.PrivacyManagerAPI;
  210.                 __qc.firepixels();
  211.             }
  212.         },
  213.         qccfp: function(action, type) {
  214.             __qc.pmc = PrivacyManagerAPI.callApi(action, __qc.qs, __qc.qcdomain(), "truste.com", type);
  215.             __qc.firepixels();
  216.         },
  217.         qcctp: function(action, type) {
  218.             var params = {
  219.                 PrivacyManagerAPI: {
  220.                     timestamp: new Date().getTime(),
  221.                     action: action,
  222.                     self: __qc.qs,
  223.                     domain: __qc.qcdomain(),
  224.                     authority: "truste.com",
  225.                     type: type
  226.                 }
  227.             };
  228.             if (window.addEventListener) {
  229.                 window.addEventListener('message', __qc.qchcr, false);
  230.             } else if (window.attachEvent) {
  231.                 window.attachEvent('onmessage', __qc.qchcr);
  232.             } else {
  233.                 __qc.pmc = true;
  234.                 __qc.firepixels();
  235.                 return;
  236.             }
  237.             try {
  238.                 window.top.postMessage(JSON.stringify(params), "*");
  239.             } catch (e) {}
  240.             __qc.pmto = setTimeout(function() {
  241.                 if (__qc.pmc === undefined) {
  242.                     __qc.pmc = true;
  243.                     __qc.firepixels();
  244.                 }
  245.             }, 25);
  246.         },
  247.         qc_consent: function(action, type) {
  248.             if (__qc.pmc === undefined) {
  249.                 if (window.top === window.self) {
  250.                     if (typeof PrivacyManagerAPI === 'object' && typeof PrivacyManagerAPI.callApi === 'function') {
  251.                         __qc.qccfp(action, type);
  252.                         return;
  253.                     }
  254.                 } else if ( !! window.postMessage && typeof JSON === 'object') {
  255.                     __qc.qcctp(action, type);
  256.                     return;
  257.                 }
  258.                 __qc.pmc = true;
  259.             }
  260.             __qc.firepixels();
  261.         },
  262.         qctv: function(cm_consent) {
  263.             var cmv = '';
  264.             if (typeof cm_consent === 'object') {
  265.                 cmv = 'p';
  266.                 cmv += cm_consent.consent === 'approved' ? 'a' : 'd';
  267.                 cmv += cm_consent.source === 'asserted' ? 'e' : 'i';
  268.             }
  269.             return cmv;
  270.         },
  271.         qcenqp: function(qoptions) {
  272.             var e = (typeof(encodeURIComponent) == 'function') ? "n" : "s";
  273.             var r = __qc.qcrnd();
  274.             var sr = '',
  275.                 qo = '',
  276.                 qm = '',
  277.                 url = '',
  278.                 ref = '',
  279.                 je = 'u',
  280.                 ns = '1';
  281.             var qocount = 0;
  282.             __qc.qad = 0;
  283.             if (typeof __qc.qpixelsent == "undefined") {
  284.                 __qc.qpixelsent = new Array();
  285.             }
  286.             if (typeof qoptions != "undefined" && qoptions != null) {
  287.                 __qc.qopts = qoptions;
  288.                 for (var k in __qc.qopts) {
  289.                     if (typeof(__qc.qopts[k]) == 'string') {
  290.                         qo = __qc.qcp("", __qc.qopts);
  291.                         break;
  292.                     } else if (typeof(__qc.qopts[k]) == 'object' && __qc.qopts[k] != null) {
  293.                         ++qocount;
  294.                         qo += __qc.qcp("." + qocount, __qc.qopts[k]);
  295.                     }
  296.                 }
  297.             } else if (typeof _qacct == "string") {
  298.                 qo = __qc.qcp("", null);
  299.             }
  300.             if (qo.length == 0) return;
  301.             var ce = (navigator.cookieEnabled) ? "1" : "0";
  302.             if (typeof navigator.javaEnabled != 'undefined') je = (navigator.javaEnabled()) ? "1" : "0";
  303.             if (typeof _qmeta != "undefined" && _qmeta != null) {
  304.                 qm = ';m=' + __qc.qceuc(_qmeta);
  305.                 _qmeta = null;
  306.             }
  307.             if (self.screen) {
  308.                 sr = screen.width + "x" + screen.height + "x" + screen.colorDepth;
  309.             }
  310.             var d = new Date();
  311.             var dst = __qc.qcdst();
  312.             var fp = __qc.qcsc();
  313.             if (window.location && window.location.href) url = __qc.qceuc(window.location.href);
  314.             if (window.document && window.document.referrer) ref = __qc.qceuc(window.document.referrer);
  315.             if (self == top) ns = '0';
  316.             var ogl = __qc.qcogl();
  317.             var p1 = '/pixel;r=' + r + qo + fp + ';ns=' + ns + ';ce=' + ce;
  318.             var p2 = ';je=' + je + ';sr=' + sr + ';enc=' + e + ';dst=' + dst + ';et=' + d.getTime() + ';tzo=' + d.getTimezoneOffset() + qm + ';ref=' + ref + ';url=' + url + ';ogl=' + ogl;
  319.             __qc.pixelcalls.push({
  320.                 p1: p1,
  321.                 p2: p2
  322.             });
  323.             __qc.firepixels();
  324.         },
  325.         fire: function(o) {
  326.             var src = 'http';
  327.             if (window.location.protocol == 'https:') {
  328.                 src += 's';
  329.             }
  330.             src += '://pixel.';
  331.             src += (__qc.pmc === true || __qc.pmc.consent === 'approved') ? __qc.qs : __qc.ql;
  332.             src += o.p1;
  333.             src += ';cm=' + __qc.qctv(__qc.pmc);
  334.             src += o.p2;
  335.             var img = new Image();
  336.             img.alt = '';
  337.             img.src = src;
  338.             img.onload = function() {
  339.                 __qc.qpxload(img);
  340.             };
  341.         },
  342.         firepixels: function() {
  343.             if (__qc.pmc) {
  344.                 while (__qc.pixelcalls.length) {
  345.                     __qc.fire(__qc.pixelcalls.shift());
  346.                 }
  347.             } else {
  348.                 __qc.qc_consent('getConsent', 'advertising');
  349.             }
  350.         },
  351.         quantserve: function() {
  352.             if (typeof _qevents == 'undefined') {
  353.                 _qevents = [];
  354.             }
  355.             if (typeof _qoptions != "undefined" && _qoptions != null) {
  356.                 __qc.qcenqp(_qoptions);
  357.                 _qoptions = null;
  358.             } else if (!_qevents.length && typeof _qacct != "undefined") {
  359.                 __qc.qcenqp(null);
  360.             }
  361.             if (!__qc.evts) {
  362.                 for (var k in _qevents) {
  363.                     __qc.qcenqp(_qevents[k]);
  364.                 }
  365.                 _qevents = {
  366.                     push: function() {
  367.                         var a = arguments;
  368.                         for (var i = 0; i < a.length; i++) {
  369.                             __qc.qcenqp(a[i]);
  370.                         }
  371.                     }
  372.                 };
  373.                 __qc.evts = 1;
  374.             }
  375.         }
  376.     };
  377. }
  378.  
  379. function quantserve() {
  380.     __qc.quantserve();
  381. }
  382. quantserve();
Advertisement
Add Comment
Please, Sign In to add comment