JSFiddle - React, Tailwind, and code Playground
by romanych
HTML
<pre id="keyValue"></pre>
JavaScript
function aplauncherExec() {
apsrc = 'https://sak.userreport.com/sdm/launcher.js';
var nSrc = document.createElement('script');
nSrc.setAttribute('src', apsrc);
nSrc.setAttribute('defer', '');
nSrc.id = 'userreport-launcher-script';
nSrc.setAttribute('type', 'text/javascript');
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(nSrc, s);
}
function aplauncher() {
setTimeout(function() {
aplauncherExec();
}, 200);
}
function loadAudienceProjectPredictions(customerId, callback, options) {
options = options || {};
var timeout = options.timeout || 1000;
var sref = '';
var ref = document.referrer;
var dsu = '';
var adsDomain = 'pdw-usr.userreport.com';
var origin = window.location.origin || window.document.origin;
if (ref) {
if (origin) {
if (ref.indexOf(origin) === -1) {
sref = ref;
try {
window.localStorage.setItem('apr_sref', sref);
} catch (e) {
}
}
}
}
if (options.disablePersonalisation) {
adsDomain = 'dnt-userreport.com';
} else {
try {
dsu = window.localStorage.getItem('apr_dsu');
sref = window.localStorage.getItem('apr_sref');
} catch (e) {
}
}
var apiType = window.fetch ? 'api' : 'js';
var url = 'https://' + adsDomain + '/' + apiType + '/v2/partner/' +
encodeURIComponent(customerId) + '/uid' +
'?med=' + encodeURIComponent(window.location.toString()) +
'&dsu=' + encodeURIComponent(dsu || '') +
'&ref=' + encodeURIComponent(ref || '') +
'&sref=' + encodeURIComponent(sref || '') +
'&gdpr=' + encodeURIComponent(options.gdprApplies || '') +
'&gdpr_consent=' + encodeURIComponent(options.consentString || '');
if (options.extra) {
for (var k in options.extra) {
if...