cdn-a.raptor.digital
Open in
urlscan Pro
34.160.206.154
Public Scan
URL:
https://cdn-a.raptor.digital/custom-config/a9be253b-64e4-48e1-8db2-321be82a0e03.js
Submission: On October 09 via api from IT — Scanned from IT
Submission: On October 09 via api from IT — Scanned from IT
Form analysis
0 forms found in the DOMText Content
/*! Copyright RNA Digital PTY LTD */ (function() { 'use strict'; if(!window) { return; } if (location && location.hostname && location.hostname.endsWith('appspot.com')) { return; } window._monitaGenPoints = {}; const genP = window._monitaGenPoints; function setVersions() { if(window) { if(!window.__monita_settings) { window.__monita_settings = {}; } window.__monita_settings.global = { template_version: '1.24g', script_version: '76', monita_token: 'a9be253b-64e4-48e1-8db2-321be82a0e03' }; } } function logDebug() { if(document.cookie.match('rap_debug=true')) { console.debug.apply(this, arguments); } } function logInfo() { if(document.cookie.match('rap_info=true')) { console.info.apply(this, arguments); } } function logErr() { if(document.cookie.match('rap_err=true')) { console.error.apply(this, arguments); } } function observeRequests() { if(window.fetch && !window.fetch.monita_count) { const originalFetch = window.fetch; try { const newFetch = async (...args) => { let [resource, config] = args; logDebug("MONITA fetch", args); parseRequester(args, "fetch"); return await originalFetch(resource, config); }; newFetch.monita_count = 1; window.fetch = newFetch; logDebug("MONITA-SETUP-SUCCESS - fetch"); } catch(e) { window.fetch = originalFetch; logErr("MONITA-SETUP-ERROR", e); } } if(XMLHttpRequest && !XMLHttpRequest.prototype.monita_count) { XMLHttpRequest.prototype.monita_count = 1; const originalHttpRequestOpen = XMLHttpRequest.prototype.open; const originalHttpRequestSend = XMLHttpRequest.prototype.send; const originalHttpRequestSetHeader = XMLHttpRequest.prototype.setRequestHeader; try { XMLHttpRequest.prototype.open = function () { logDebug("MONITA xhr-open", arguments, this._monita_key, this); originalHttpRequestOpen.apply(this, arguments); const method = arguments[0]; if(method.toUpperCase() == "POST" || method.toUpperCase() == "PUT") { const key = (new Date()).getTime(); this._monita_key = key; genP[key] = { url: arguments[1], method }; } else { logDebug("MONITA xhr-send (URL)", arguments); parseRequester(arguments, "xhr-url"); } }; XMLHttpRequest.prototype.setRequestHeader = function () { logDebug("MONITA xhr-setRequestHeader", arguments, this._monita_key, this); originalHttpRequestSetHeader.apply(this, arguments); if(this._monita_key && arguments[0] == "Content-Type") { const gen = genP[this._monita_key] || {}; gen.contentType = arguments[1]; } }; XMLHttpRequest.prototype.send = function () { originalHttpRequestSend.apply(this, arguments); if(this._monita_key) { const gen = genP[this._monita_key] || {}; parseRequester({url: gen.url, body: arguments[0]}, "xhr-body"); logDebug("MONITA xhr-send (captured)", arguments, arguments[0] && arguments[0].constructor && arguments[0].constructor.name, this._monita_key, gen); } else { logDebug("MONITA xhr-send", arguments, arguments[0] && arguments[0].constructor && arguments[0].constructor.name, this._monita_key, this); } }; logDebug("MONITA-SETUP-SUCCESS - XMLHttpRequest"); } catch(e) { XMLHttpRequest.prototype.open = originalHttpRequestOpen; XMLHttpRequest.prototype.send = originalHttpRequestSend; XMLHttpRequest.prototype.setRequestHeader = originalHttpRequestSetHeader; } } if(navigator && navigator.sendBeacon && !navigator.sendBeacon.monita_count) { const originalSendBeacon = navigator.sendBeacon; try { const __navsendbeaconFn = (...params) => { logDebug("MONITA beacon", params); parseRequester({url: params[0], body: params[1]}, "beacon"); originalSendBeacon.bind(navigator)(...params); }; __navsendbeaconFn.monita_count = 1; navigator.sendBeacon = __navsendbeaconFn; logDebug("MONITA-SETUP-SUCCESS - sendBeacon"); } catch(e) { navigator.sendBeacon = originalSendBeacon; logErr("MONITA-SETUP-ERROR", e); } } if(PerformanceObserver && !window._monitaPerforma) { try { const observer = new PerformanceObserver((entries) => { entries.getEntriesByType("resource") .map(res => res.toJSON()) .forEach(val => { logDebug("MONITA resource", val); return parseRequester([val.name], "resource");}) }); window._monitaPerforma = observer; observer.observe({entryTypes: ["resource"]}); logDebug("MONITA-SETUP-SUCCESS - performance observer"); } catch (e) { logErr("MONITA-SETUP-ERROR", e); } } try { window.monitaSendBeacon = function(vendor, event, data) { const parsedData = typeof data != "object" ? {data: data} : data; const request = {body: {vendorName: String(vendor), event: String(event), ...JSON.parse(JSON.stringify(parsedData))}, url: "https://mon-collect.getmonita.io/api/v1"}; parseRequester(request, "beacon"); } } catch (e) { logErr("MONITA-SETUP-ERROR", e); } } function generateUUID() { let d = new Date().getTime(); let d2 = (performance && performance.now && (performance.now()*1000)) || 0; return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { let r = Math.random() * 16; if(d > 0){ r = (d + r)%16 | 0; d = Math.floor(d/16); } else { r = (d2 + r)%16 | 0; d2 = Math.floor(d2/16); } return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); }); } function getmse() { let mse = sessionStorage.getItem("mse"); let mst = sessionStorage.getItem("mst"); if(!mse || !mst || ((new Date()).getTime() - mst) > 1800000) { mse = generateUUID(); sessionStorage.setItem("mse", mse); } mst = (new Date()).getTime(); sessionStorage.setItem("mst", mst); return mse; } const uriDecode = decodeURIComponent || decodeURI || function(part) {return part}; const getKeys = function (keyPath) { return keyPath.split('.').reduce(function (acc, x, i, arr) { if (x.startsWith('"') || x.startsWith("'")) { var dt = [x.substr(1)]; var endChar = x.substr(0, 1); if (x.endsWith(endChar)) { acc.push(x.substr(1, x.length - 2)); } else { for (var j = i + 1; j < arr.length; j++) { if (arr[j].endsWith(endChar)) { dt.push(arr[j].substr(0, arr[j].length - 1)); acc.nextI = j + 1; break; } else { dt.push(arr[j]); } } if (!acc.nextI) { acc.push(x); } else { acc.push(dt.join(".")); } } } else if (acc.nextI) { if (acc.nextI == i) { acc.push(x); delete acc.nextI; } } else { acc.push(x); } return acc; }, []).slice(0); }; const flatten = function (array) { return array.reduce(function (arr, i) { (Array.isArray(i) ? arr = arr.concat(flatten(i)) : arr.push(i)); return arr; }, []); }; const multiply = function (array) { return array.reduce(function (arr, i) { arr = Array.isArray(i) ? flatten(arr.map(function (e) { return i.map(function (i1) { return multiply([e, i1]); }); })) : arr.map(function (e) { return e + i; }); return arr; }, [""]); }; const dotAccess = function (obj, key) { return (Array.isArray(key) ? key : getKeys(key)).reduce(function (o, k) { if (o && typeof o == 'object') { if (Array.isArray(o)) { var m = flatten(o.map(function (r) { return dotAccess(r, [k]); })).filter(function (r) { return r != null; }); return m.length > 0 ? m : null; } else if (k in o) { return o[k]; } } return null; }, obj); }; const fillParamsFromData = function fillParamsFromData(parameterisedStr, data) { if (parameterisedStr && parameterisedStr.length > 0) { var len = parameterisedStr.length; var i = 0; var output = []; var part = ""; var s = parameterisedStr.split(/(\{\{)|(\}\})/ig); if (s.length > 1) { while (i < len) { var c = parameterisedStr[i]; if (i < (len - 1) && c == "{" && parameterisedStr[i] == "{") { if (part.length > 0) { output.push(part); part = ""; } var parameter = ""; for (i = i + 2; i < len; i++) { c = parameterisedStr[i]; if (i < (len - 1) && c == "}" && parameterisedStr[i] == "}") { i = i + 1; if (parameter.length > 0) { var value = void 0; var functionSplit = parameter.split("::"); if (functionSplit.length == 3) { var fn = functionSplit[0], params = functionSplit[1], field = functionSplit[2]; value = dotAccess(data, field); if (value && typeof value == "string") { switch (fn) { case "regex": try { value = value.match(new RegExp(params)); } catch (_a) { } if (value) { value = value[0]; } default: ; } } } else { value = dotAccess(data, parameter); } if (value != null) { output.push(value); } parameter = ""; break; } } else { parameter += c; } } if (parameter.length > 0) { output.push(parameter); } } else { part += c; } i++; } if (part.length > 0) { output.push(part); } output = multiply(output); return output.length == 1 ? output[0] : output; } else { return dotAccess(data, parameterisedStr); } } return parameterisedStr; }; const getBodyJSON = function getBodyJSON(url, body, data, contentTypeHint) { if (contentTypeHint === void 0) { contentTypeHint = null; } var urlObj = new URL(url); if (urlObj.search && urlObj.search.split("&").length > 1) { var searchParamsEntries = Array.from(urlObj.searchParams.entries()); if (searchParamsEntries.length > 0) { for (var _i = 0, searchParamsEntries_1 = searchParamsEntries; _i < searchParamsEntries_1.length; _i++) { var _a = searchParamsEntries_1[_i], key = _a[0], value = _a[1]; data[key] = decodeURIComponent(value); } } } else if (urlObj.search && urlObj.search.substring(1).split(";").length > 1) { // Check legacy parameters var legacyParameters = urlObj.search.substring(1).split(";").map(function (x) { return x.split("="); }).filter(function (x) { return x.length == 2; }); for (var _b = 0, legacyParameters_1 = legacyParameters; _b < legacyParameters_1.length; _b++) { var _c = legacyParameters_1[_b], key = _c[0], value = _c[1]; data[key] = decodeURIComponent(value); } } if (body == null || body == undefined) { return; } var bodyContent = body; if (typeof body == "string") { try { bodyContent = JSON.parse(body); } catch (_d) { if (body.split(";").length > 1) { var legacyBodyParameters = body.split(";").map(function (x) { return x.split("="); }).filter(function (x) { return x.length == 2; }); if (legacyBodyParameters.length > 1) { bodyContent = Object.fromEntries(legacyBodyParameters.map(function (_a) { var key = _a[0], val = _a[1]; return [key, decodeURIComponent(val)]; })); } } else if (body.split("&").length > 1) { var bodyAsURLParams = Array.from((new URLSearchParams(body)).entries()); if ((bodyAsURLParams.length == 1 && bodyAsURLParams[0][1] != '') || bodyAsURLParams.length > 1) { bodyContent = Object.fromEntries(bodyAsURLParams.map(function (_a) { var key = _a[0], val = _a[1]; return [key, decodeURIComponent(val)]; })); } } } } fillDataFromBody(data, bodyContent, contentTypeHint); }; const checkPassOnFilters = function checkPassOnFilters(data, filters) { for (var _i = 0, filters_1 = filters; _i < filters_1.length; _i++) { var f = filters_1[_i]; var filterValues = Array.isArray(f.val) ? f.val : [f.val]; if (["eq", "contains"].indexOf(f.op) >= 0) { var result = false; var checkFn = f.op === "eq" ? function (val, filterVal) { return val == filterVal; } : function (val, filterVal) { return typeof val == "string" && val.includes(filterVal); }; var val = fillParamsFromData(f.key, data); for (var _a = 0, filterValues_1 = filterValues; _a < filterValues_1.length; _a++) { var filterValue = filterValues_1[_a]; if (checkFn(val, filterValue)) { result = true; break; } } if (!result) { return false; } } else if (["ne"].indexOf(f.op) >= 0) { for (var _b = 0, filterValues_2 = filterValues; _b < filterValues_2.length; _b++) { var filterValue = filterValues_2[_b]; if (fillParamsFromData(f.key, data) == filterValue) { return false; } } } else { if (f.op == "blank") { var value = fillParamsFromData(f.key, data); if (value != undefined && value != null && (typeof value !== 'string' || value.length > 0)) { return false; } } else if (f.op == "not_blank") { var value = fillParamsFromData(f.key, data); if (value == undefined || value == null || (typeof value === 'string' && value.length == 0)) { return false; } } else if (f.op == "exist") { var value = fillParamsFromData(f.key, data); if (value === undefined || value === null) { return false; } } else if (f.op == "not_exist") { var val = fillParamsFromData(f.key, data); if (val !== undefined && val !== null) { return false; } } } } return true; }; const fillDataFromBody = function fillDataFromBody(dataObj, body, type) { if (type === void 0) { type = null; } var parsed = getDataByType(body, type); switch (parsed.type) { case "null": break; case "primitive": case "string": dataObj.value = parsed.data; break; case "array": for (var i = 0; i < parsed.dataArray.length; i++) { var item = parsed.dataArray[i]; switch (item.type) { case "null": case "primitive": case "string": dataObj[i] = item.data; break; case "object": default: dataObj[i] = {}; Object.assign(dataObj[i], item.data); } } break; case "object": default: Object.assign(dataObj, parsed.data); } }; const getDataByType = function getDataByType(object, hintType) { if (hintType === void 0) { hintType = null; } if (object === undefined || object === null) { return { type: "null", data: object }; } else if (typeof object === "number" || typeof object === "bigint" || typeof object === "boolean") { return { type: "primitive", data: object }; } else if (Array.isArray(object)) { return { type: "array", dataArray: object.map(getDataByType) }; } else if (typeof object === "object") { var type = object && object.constructor && object.constructor.name; if (!type) { return { type: "unknown", object: object }; } else { if ((type.startsWith("Int") || type.startsWith("Uint")) && type.endsWith("Array")) { return getDataByType(new TextDecoder().decode(object), hintType); } else if (type === "FormData") { var formData = Array.from(object).reduce(function (fields, item) { var fieldData = {}; fillDataFromBody(fieldData, item[1], null); fields[item[0]] = fieldData; return fields; }, {}); return { type: "object", data: formData }; } else { return { type: "object", data: object }; } } } else if (typeof object === "string") { var type = void 0, parsedString = void 0; if (hintType == "application/json" || (object.startsWith("{") || object.startsWith("["))) { try { parsedString = JSON.parse(object); type = "object"; } catch (_a) { } } if (!parsedString) { try { parsedString = Object.fromEntries(new URLSearchParams(object)); if (Object.keys(parsedString).length == 1 && parsedString[object] == "") { // not really URL search Params parsedString = object; type = "string"; } else { type = "object"; } } catch (_b) { } } if (!parsedString) { parsedString = object; type = "string"; } return { type: type, data: parsedString }; } return { type: "object", data: object }; }; function parseRequester(args, type) { try { let urlArg, method; let data = {}; if(type === "fetch" || type === "resource") { urlArg = args[0]; method = "GET"; if(args.length > 1) { const resData = args[1] || {}; if(resData.method) { method = resData.method.toUpperCase(); } if(resData.body) { getBodyJSON(urlArg, resData.body, data); } } } else if (type === "beacon") { urlArg = args["url"]; method = "POST"; getBodyJSON(urlArg, args.body, data); } else if(type === "xhr-url") { urlArg = args[1]; if(urlArg.startsWith("//")) { urlArg = "https:" + urlArg; } method = (args["body"] && args["body"].method) || ""; } else if (type == "xhr-body") { urlArg = args["url"]; method = (args["body"] && args["body"].method) || ""; getBodyJSON(urlArg, args.body, data, args["contentType"]); } const urlObj = new URL(urlArg); data.__mon_url = urlArg; data.__mon_host = urlObj.host; data.__mon_method = method; let matches = false; if(urlArg == "https://mon-collect.getmonita.io/api/v1" && data.vendorName && matchVendorByName(data.vendorName)) { const vendorFilters = getVendorEventFilters(data.vendorName); matches = true; } else { filterLoop: for(let m of getCustomerVendors()) { if(urlArg.indexOf(m) >= 0) { data.vendorName = matchVendorByPathPattern(m.substring(1)) || ""; matches = true; break filterLoop; } } } if(matches) { const vendorFilters = getVendorEventFilters(data.vendorName); const pass = checkPassOnFilters(data, vendorFilters); if(pass) { sendData(data); } else { matches = false; } } if(matches == false) { logInfo("MONITA NO MATCH", urlArg); } } catch (e) { logErr("MONITA-ERROR", e, type, args); } } function getInOrder(_test, _default, _sources) { if(!_test) { _test = (val) => val != undefined && val != null && val != false; } for(let i = 0; i < _sources.length; i++) { const val = _sources[i]; if(_test(val)) { return val; } } return _default; } function filterData(vendor, data, newParametersList) { try { const execludedParams = new Set(getvendorExecludeParams(vendor)); if(vendor) { const newData = {}; let keyCount = 100; for(let p of Object.keys(data)) { --keyCount; if(keyCount < 0) { break; } newData[p] = data[p]; } for (let ep of execludedParams) { try { deleteProperty(newData, ep); } catch (e) { logDebug(e); } } return newData; } else { return {}; } } catch(err) { logErr(err); return data; } } function sendData(data) { const event = getInOrder(null, "", [ window.__monita_settings && window.__monita_settings.get_event && window.__monita_settings.get_event(data.vendorName, data) , getVendorEventFields(data.vendorName) && fillParamsFromData(getVendorEventFields(data.vendorName), data) , getVendorDefaultEventFields(data.vendorName) && fillParamsFromData(getVendorDefaultEventFields(data.vendorName), data) , data && data.event , data && data.ev ]); const newParameters = []; const updatedData = filterData(data.vendorName, data, newParameters); const payload = { "t": "a9be253b-64e4-48e1-8db2-321be82a0e03", "dm": "script", "mv": "1.24g", "sv": "76", "tm": Date.now()/1000, "e": event || null, "vn": data.vendorName, "st": undefined, "m": data.__mon_method, "vu": data.__mon_url, "u": window.location.href, "p": window.location.pathname, "dt": [updatedData], "np": newParameters }; Object.assign(payload, getSystemContextData()); if(payload.sid === undefined || payload.sid === null) { payload.sid = getmse(); } if(Array.isArray(event)) { for(let e of event) { const eventPayload = JSON.parse(JSON.stringify(payload)); eventPayload.e = e; const monitaAllowed = getInOrder((val) => val === true || val === false, true, [window.__monita_settings && window.__monita_settings.is_monita_allowed && window.__monita_settings.is_monita_allowed(eventPayload)]); if(monitaAllowed !== false) { navigator.sendBeacon("https://stream.raptor.digital/api/v1/", JSON.stringify(payload)); logInfo("MONITA-SEND", e, eventPayload); } } } else { const monitaAllowed = getInOrder((val) => val === true || val === false, true, [window.__monita_settings && window.__monita_settings.is_monita_allowed && window.__monita_settings.is_monita_allowed(payload)]); if(monitaAllowed !== false) { navigator.sendBeacon("https://stream.raptor.digital/api/v1/", JSON.stringify(payload)); logInfo("MONITA-SEND", payload); } } } function getSystemContextData() { return getInOrder(null, getPresetSystemContextData(), [window.__monita_settings && window.__monita_settings.get_tms_data && window.__monita_settings.get_tms_data(window)]); } function getPresetSystemContextData() { const u = getInOrder(null, {}, [window.__monita_settings && window.__monita_settings.get_utag && window.__monita_settings.get_utag(window), window.utag]); if (u && u.cfg && u.data) { const tealium = { "s": "tealium", "rl": u.cfg.v, "env": u.cfg.environmentName, "do": u.cfg.utid, "et": 0, "vid": "1", "cn": getInOrder(null, null, [window.__monita_settings.get_consent && window.__monita_settings.get_consent()]), "sid": getInOrder(null, null, [window.__monita_settings.get_session_id && window.__monita_settings.get_session_id(), u.data["ut.session_id"]]), "cid": getInOrder(null, null, [window.__monita_settings.get_customer_id && window.__monita_settings.get_customer_id()]) }; return tealium; } else { return { "do": window.location.host, "cn": getInOrder(null, null, [window.__monita_settings.get_consent && window.__monita_settings.get_consent()]), "sid": getInOrder(null, null, [window.__monita_settings.get_session_id && window.__monita_settings.get_session_id()]), "cid": getInOrder(null, null, [window.__monita_settings.get_customer_id && window.__monita_settings.get_customer_id()]) }; } } const vendorUrlMap = Object.freeze({ "b/ss": "Adobe Analytics", "collect.tealiumiq.com": "Tealium" }); const vendorUrlKeys = Object.keys(vendorUrlMap); const vendorNames = new Set(Object.values(vendorUrlMap)); const vendorUrlMatches = new Set(vendorUrlKeys.map(key => "/" + key).concat(vendorUrlKeys.map(key => "." + key))); logDebug("VENDOR URL MATCHES", vendorUrlMatches); const vendorExecludeParams = Object.freeze({ "Adobe Analytics": [], "Tealium": [] }); const vendorsStandardParameters = Object.freeze({ "Adobe Analytics": [], "Tealium": [] }); const vendorDefaultEventFields = Object.freeze({ "Adobe Analytics": "events", "Tealium": "" }); const vendorsEventFilters = Object.freeze({ "Adobe Analytics": [ { "key": "events", "op": "contains", "val": [ "event133", "purchase" ] }, { "key": "pageName", "op": "contains", "val": [ ":TYP" ] } ], "Tealium": [ { "key": "data.data.page_name", "op": "contains", "val": [ ":TYP" ] }, { "key": "data.data.link_name", "op": "not_exist", "val": "" }, { "key": "data.data.tealium_event", "op": "contains", "val": [ "transaction_complete" ] }, { "key": "data.data.page_type", "op": "contains", "val": [ "TYP" ] } ] }); const vendorsEventFields = Object.freeze({ "Adobe Analytics": "events", "Tealium": "data.data.tealium_event" }); const vendorsNewParamsCheck = Object.freeze({ "Adobe Analytics": false, "Tealium": false }); function getCustomerVendors() { return vendorUrlMatches; } function matchVendorByName(vendorName) { return vendorNames.has(vendorName); } function matchVendorByPathPattern(vendorName) { return vendorUrlMap[vendorName]; } function getvendorExecludeParams(vendor) { return vendorExecludeParams[vendor]; } function getVendorStandardParams(vendor) { return vendorsStandardParameters[vendor]; } function getVendorDefaultEventFields(vendor) { return vendorDefaultEventFields[vendor]; } function getVendorEventFilters(vendor) { return vendorsEventFilters[vendor]; } function getVendorEventFields(vendor) { return vendorsEventFields[vendor]; } function getVendorCheckForNewParams(vendor) { return vendorsNewParamsCheck[vendor]; } observeRequests(); setVersions(); })();