Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //~~tv:16053.20181129
- //~~tc: Adding tag Pendo.io
- var pendo = window["pendo"] = window["pendo"] || {};
- pendo._q = [];
- //tealium universal tag - utag.sender.16053 ut4.0.##UTVERSION##, Copyright ##UTYEAR## Tealium.com Inc. All Rights Reserved.
- try {
- (function (id, loader) {
- var u = {"id" : id};
- utag.o[loader].sender[id] = u;
- // Please do not modify
- if (utag.ut === undefined) { utag.ut = {}; }
- // Start Tealium loader 4.41
- /* utag.js version 4.26 or above is required to avoid errors with this loader function */
- var match = /ut\d\.(\d*)\..*/.exec(utag.cfg.v);
- if (utag.ut.loader === undefined || !match || parseInt(match[1]) < 41) { u.loader = function(o, a, b, c, l, m) { utag.DB(o); a = document; if (o.type == "iframe") { m = a.getElementById(o.id); if (m && m.tagName == "IFRAME") { b = m; } else { b = a.createElement("iframe"); } o.attrs = o.attrs || {}; utag.ut.merge(o.attrs, { "height": "1", "width": "1", "style": "display:none" }, 0); } else if (o.type == "img") { utag.DB("Attach img: " + o.src); b = new Image(); } else { b = a.createElement("script"); b.language = "javascript"; b.type = "text/javascript"; b.async = 1; b.charset = "utf-8"; } if (o.id) { b.id = o.id; } for (l in utag.loader.GV(o.attrs)) { b.setAttribute(l, o.attrs[l]); } b.setAttribute("src", o.src); if (typeof o.cb == "function") { if (b.addEventListener) { b.addEventListener("load", function() { o.cb(); }, false); } else { b.onreadystatechange = function() { if (this.readyState == "complete" || this.readyState == "loaded") { this.onreadystatechange = null; o.cb(); } }; } } if (o.type != "img" && !m) { l = o.loc || "head"; c = a.getElementsByTagName(l)[0]; if (c) { utag.DB("Attach to " + l + ": " + o.src); if (l == "script") { c.parentNode.insertBefore(b, c); } else { c.appendChild(b); } } } }; } else { u.loader = utag.ut.loader; }
- // End Tealium loader
- // Start Tealium typeOf 4.35
- if (utag.ut.typeOf === undefined) { u.typeOf = function(e) {return ({}).toString.call(e).match(/\s([a-zA-Z]+)/)[1].toLowerCase();};} else { u.typeOf = utag.ut.typeOf; }
- // End Tealium typeOf
- u.ev = {"view" : 1};
- u.initialized = false;
- u.scriptrequested = false;
- u.queue = [];
- u.map_func = function (arr, obj, item) {
- var i = arr.shift();
- obj[i] = obj[i] || {};
- if (arr.length > 0) {
- u.map_func(arr,obj[i], item);
- } else {
- obj[i] = item;
- }
- };
- u.hasOwn = function (o, a) {
- return o != null && Object.prototype.hasOwnProperty.call(o, a);
- };
- u.isEmptyObject = function (o, a) {
- for (a in o) { if (u.hasOwn(o, a)) {return false;}} return true;
- };
- u.toBoolean = function (val) {
- val = val || "";
- return val === true || val.toLowerCase() === "true" || val.toLowerCase() === "on";
- };
- ##UTGEN##
- // Start Loader Callback
- u.loader_cb = function (a, b, c) {
- utag.DB("send:##UTID##:CALLBACK");
- u.initialized = true;
- if(u.toBoolean(u.data.send_user_data)){
- var pendo_object = {}, options;
- if(u.data.additional_keys.length > 0){pendo_object.additionalApiKeys = u.data.additional_keys;}
- if(u.toBoolean(u.data.exclude_text)){pendo_object.excludeAllText = u.toBoolean(u.data.exclude_text);}
- if(u.toBoolean(u.data.disable_guides)){pendo_object.disableGuides = u.toBoolean(u.data.disable_guides);}
- if(u.toBoolean(u.data.exclude_title)){pendo_object.excludeTitle = u.toBoolean(u.data.exclude_title);}
- for(options in u.data.custom){
- pendo_object[options] = u.data.custom[options];
- }
- if(!u.isEmptyObject(u.data.visitor)){pendo_object.visitor = u.data.visitor;}
- if(!u.isEmptyObject(u.data.account)){pendo_object.account = u.data.account;}
- pendo.initialize(pendo_object);
- }
- utag.DB("send:##UTID##:CALLBACK:COMPLETE");
- };
- // End Loader Callback
- u.callBack = function () {
- var data = {};
- while (data = u.queue.shift()) {
- u.data = data.data;
- u.loader_cb(data.a, data.b, data.c);
- }
- };
- u.send = function (a, b) {
- if (u.ev[a] || u.ev.all !== undefined) {
- utag.DB("send:##UTID##");
- utag.DB(b);
- var c, d, e, f;
- u.data = {
- "qsp_delim" : "&",
- "kvp_delim" : "=",
- "base_url" : "https://cdn.pendo.io/agent/static/##utag_api_key##/pendo.js",
- "api_key" : "##UTVARconfig_api_key##",
- "additional_keys" : "##UTVARconfig_additional_keys##",
- "send_user_data" : "##UTVARconfig_send_user_data##",
- "visitor" : {},
- "account" : {},
- "exclude_text" : "",
- "disable_guides" : "",
- "exclude_title" : "",
- "custom" : {}
- };
- // Start tag-scoped extensions
- ##UTEXTEND##
- utag.DB("send:##UTID##:EXTENSIONS");
- utag.DB(b);
- // End tag-scoped extensions
- c = [];
- // Start Mapping
- for (d in utag.loader.GV(u.map)) {
- if (b[d] !== undefined && b[d] !== "") {
- e = u.map[d].split(",");
- for (f = 0; f < e.length; f++) {
- var checkProp = e[f].split(".");
- if (u.data.hasOwnProperty(checkProp[0])) {
- u.map_func(e[f].split("."), u.data, b[d]);
- } else {
- u.data.custom[e[f]] = b[d];
- }
- }
- }
- }
- utag.DB("send:##UTID##:MAPPINGS");
- utag.DB(u.data);
- // End Mapping
- var options = ["initialize", "identify", "updateOptions", "pageLoad"];
- var w, x = options.length;
- for (w = 0; w < x; ++w){
- pendo[options[w]] = pendo[options[w]] || function() {pendo._q[options[w] === options[0] ? "unshift" : "push"]([options[w]].concat([].slice.call(arguments, 0)));};
- }
- // Report required config is missing, and stop tag from firing.
- if (!u.data.api_key) {
- utag.DB(u.id + ": Tag not fired: Required attribute not populated");
- return;
- }
- u.data.base_url = u.data.base_url.replace("##utag_api_key##",u.data.api_key);
- if (u.initialized) {
- u.loader_cb(a, b, c);
- } else {
- // While waiting for the external library to load, queue up all of the events with their corresponding data objects.
- u.queue.push({"data" : u.data, "a" : a, "b" : b, "c" : c});
- if (!u.scriptrequested) {
- u.scriptrequested = true;
- u.loader({
- "type" : "script",
- "src" : u.data.base_url,
- "cb" : u.callBack,
- "loc" : "script",
- "id" : "utag_##UTID##",
- "attrs" : {}
- });
- }
- }
- utag.DB("send:##UTID##:COMPLETE");
- }
- };
- utag.o[loader].loader.LOAD(id);
- }("##UTID##", "##UTLOADERID##"));
- } catch (error) {
- utag.DB(error);
- }
- //end tealium universal tag
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement