rudder-sdk-js 2.7.0 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +314 -178
- package/package.json +1 -1
package/index.js
CHANGED
@@ -4511,6 +4511,39 @@
|
|
4511
4511
|
return isObject$1(val) || Array.isArray(val) || typeof val === 'function';
|
4512
4512
|
}
|
4513
4513
|
|
4514
|
+
/* eslint-disable no-use-before-define */
|
4515
|
+
// import logger from "../utils/logUtil";
|
4516
|
+
var defaultAsyncState = true;
|
4517
|
+
var LOAD_ORIGIN = "RS_JS_SDK";
|
4518
|
+
|
4519
|
+
var ScriptLoader = function ScriptLoader(id, src) {
|
4520
|
+
var async = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultAsyncState;
|
4521
|
+
var exists = document.getElementById(id);
|
4522
|
+
|
4523
|
+
if (exists) {
|
4524
|
+
// logger.debug("script already loaded");
|
4525
|
+
return;
|
4526
|
+
}
|
4527
|
+
|
4528
|
+
var js = document.createElement("script");
|
4529
|
+
js.src = src;
|
4530
|
+
js.async = async === undefined ? defaultAsyncState : async;
|
4531
|
+
js.type = "text/javascript";
|
4532
|
+
js.id = id;
|
4533
|
+
js.dataset.loader = LOAD_ORIGIN;
|
4534
|
+
var headElmColl = document.getElementsByTagName("head");
|
4535
|
+
|
4536
|
+
if (headElmColl.length !== 0) {
|
4537
|
+
// logger.debug("==adding script==", js);
|
4538
|
+
headElmColl[0].insertBefore(js, headElmColl[0].firstChild);
|
4539
|
+
} else {
|
4540
|
+
var e = document.getElementsByTagName("script")[0]; // logger.debug("==parent script==", e);
|
4541
|
+
// logger.debug("==adding script==", js);
|
4542
|
+
|
4543
|
+
e.parentNode.insertBefore(js, e);
|
4544
|
+
}
|
4545
|
+
};
|
4546
|
+
|
4514
4547
|
var LOG_LEVEL_INFO = 1;
|
4515
4548
|
var LOG_LEVEL_DEBUG = 2;
|
4516
4549
|
var LOG_LEVEL_WARN = 3;
|
@@ -4860,14 +4893,16 @@
|
|
4860
4893
|
};
|
4861
4894
|
|
4862
4895
|
// Reserved Keywords for properties/traits
|
4863
|
-
var RESERVED_KEYS = [
|
4864
|
-
var CONFIG_URL =
|
4865
|
-
var CDN_INT_DIR =
|
4896
|
+
var RESERVED_KEYS = ['anonymous_id', 'id', 'sent_at', 'received_at', 'timestamp', 'original_timestamp', 'event_text', 'event'];
|
4897
|
+
var CONFIG_URL = 'https://api.rudderlabs.com/sourceConfig/?p=npm&v=2.8.0';
|
4898
|
+
var CDN_INT_DIR = 'js-integrations';
|
4866
4899
|
var DEST_SDK_BASE_URL = "https://cdn.rudderlabs.com/v1.1/".concat(CDN_INT_DIR);
|
4867
4900
|
var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000;
|
4868
4901
|
var INTEGRATION_LOAD_CHECK_INTERVAL = 1000;
|
4869
|
-
var INTG_SUFFIX =
|
4870
|
-
var POLYFILL_URL =
|
4902
|
+
var INTG_SUFFIX = '_RS';
|
4903
|
+
var POLYFILL_URL = 'https://polyfill.io/v3/polyfill.min.js?features=Array.prototype.find%2CArray.prototype.includes%2CPromise%2CString.prototype.endsWith%2CString.prototype.includes%2CString.prototype.startsWith%2CObject.entries%2CObject.values%2CElement.prototype.dataset';
|
4904
|
+
var DEFAULT_ERROR_REPORT_PROVIDER = 'bugsnag';
|
4905
|
+
var ERROR_REPORT_PROVIDERS = [DEFAULT_ERROR_REPORT_PROVIDER];
|
4871
4906
|
|
4872
4907
|
var aes = {exports: {}};
|
4873
4908
|
|
@@ -10220,31 +10255,58 @@
|
|
10220
10255
|
|
10221
10256
|
xhr.send();
|
10222
10257
|
}
|
10258
|
+
/**
|
10259
|
+
* This function is to add breadcrumbs
|
10260
|
+
* @param {string} breadcrumb Message to add insight of an user's journey before the error occurred
|
10261
|
+
*/
|
10262
|
+
|
10263
|
+
|
10264
|
+
function leaveBreadcrumb(breadcrumb) {
|
10265
|
+
if (window.rsBugsnagClient) {
|
10266
|
+
window.rsBugsnagClient.leaveBreadcrumb(breadcrumb);
|
10267
|
+
}
|
10268
|
+
}
|
10269
|
+
/**
|
10270
|
+
* This function is to send handled errors to Bugsnag if Bugsnag client is available
|
10271
|
+
* @param {Error} error Error instance from handled error
|
10272
|
+
*/
|
10273
|
+
|
10274
|
+
|
10275
|
+
function notifyError(error) {
|
10276
|
+
if (window.rsBugsnagClient) {
|
10277
|
+
window.rsBugsnagClient.notify(error);
|
10278
|
+
}
|
10279
|
+
}
|
10223
10280
|
|
10224
10281
|
function handleError(error, analyticsInstance) {
|
10225
|
-
var errorMessage = error.message
|
10226
|
-
var sampleAdBlockTest;
|
10282
|
+
var errorMessage = error.message;
|
10227
10283
|
|
10228
10284
|
try {
|
10229
10285
|
if (error instanceof Event) {
|
10230
|
-
|
10231
|
-
|
10232
|
-
|
10233
|
-
|
10234
|
-
|
10235
|
-
|
10236
|
-
|
10237
|
-
|
10238
|
-
|
10239
|
-
|
10286
|
+
// Discard all the non-script loading errors
|
10287
|
+
if (error.target && error.target.localName !== "script") return; // Discard errors of scripts that are not loaded by the SDK
|
10288
|
+
|
10289
|
+
if (error.target.dataset && error.target.dataset.loader !== LOAD_ORIGIN) return;
|
10290
|
+
errorMessage = "error in script loading:: src:: ".concat(error.target.src, " id:: ").concat(error.target.id); // SDK triggered ad-blocker script
|
10291
|
+
|
10292
|
+
if (error.target.id === "ad-block") {
|
10293
|
+
analyticsInstance.page("RudderJS-Initiated", "ad-block page request", {
|
10294
|
+
path: "/ad-blocked",
|
10295
|
+
title: errorMessage
|
10296
|
+
}, analyticsInstance.sendAdblockPageOptions); // No need to proceed further for Ad-block errors
|
10297
|
+
|
10298
|
+
return;
|
10240
10299
|
}
|
10241
10300
|
}
|
10242
10301
|
|
10243
|
-
|
10244
|
-
|
10245
|
-
|
10246
|
-
|
10247
|
-
|
10302
|
+
errorMessage = "[handleError]:: \"".concat(errorMessage, "\"");
|
10303
|
+
logger.error(errorMessage);
|
10304
|
+
var errorObj = error;
|
10305
|
+
if (!(error instanceof Error)) errorObj = new Error(errorMessage);
|
10306
|
+
notifyError(errorObj);
|
10307
|
+
} catch (err) {
|
10308
|
+
logger.error("[handleError] Exception:: ", err);
|
10309
|
+
notifyError(err);
|
10248
10310
|
}
|
10249
10311
|
}
|
10250
10312
|
|
@@ -10493,7 +10555,7 @@
|
|
10493
10555
|
this.build = "1.0.0";
|
10494
10556
|
this.name = "RudderLabs JavaScript SDK";
|
10495
10557
|
this.namespace = "com.rudderlabs.javascript";
|
10496
|
-
this.version = "2.
|
10558
|
+
this.version = "2.8.0";
|
10497
10559
|
});
|
10498
10560
|
|
10499
10561
|
/* eslint-disable max-classes-per-file */
|
@@ -10502,7 +10564,7 @@
|
|
10502
10564
|
_classCallCheck(this, RudderLibraryInfo);
|
10503
10565
|
|
10504
10566
|
this.name = "RudderLabs JavaScript SDK";
|
10505
|
-
this.version = "2.
|
10567
|
+
this.version = "2.8.0";
|
10506
10568
|
}); // Operating System information class
|
10507
10569
|
|
10508
10570
|
|
@@ -12528,23 +12590,6 @@
|
|
12528
12590
|
value: function setQueue(value) {
|
12529
12591
|
this.storage.set(this.queueName, value);
|
12530
12592
|
}
|
12531
|
-
/**
|
12532
|
-
*
|
12533
|
-
* Utility method for excluding null and empty values in JSON
|
12534
|
-
* @param {*} _key
|
12535
|
-
* @param {*} value
|
12536
|
-
* @returns
|
12537
|
-
*/
|
12538
|
-
|
12539
|
-
}, {
|
12540
|
-
key: "replacer",
|
12541
|
-
value: function replacer(_key, value) {
|
12542
|
-
if (value === null || value === undefined) {
|
12543
|
-
return undefined;
|
12544
|
-
}
|
12545
|
-
|
12546
|
-
return value;
|
12547
|
-
}
|
12548
12593
|
}, {
|
12549
12594
|
key: "enqueue",
|
12550
12595
|
value: function enqueue(message) {
|
@@ -12555,7 +12600,7 @@
|
|
12555
12600
|
var data = {
|
12556
12601
|
batch: batch
|
12557
12602
|
};
|
12558
|
-
var dataToSend = JSON.stringify(data,
|
12603
|
+
var dataToSend = JSON.stringify(data, replacer);
|
12559
12604
|
|
12560
12605
|
if (dataToSend.length > defaults.maxPayloadSize) {
|
12561
12606
|
batch = queue.slice(0, queue.length - 1);
|
@@ -12596,7 +12641,7 @@
|
|
12596
12641
|
var data = {
|
12597
12642
|
batch: batch
|
12598
12643
|
};
|
12599
|
-
var payload = JSON.stringify(data,
|
12644
|
+
var payload = JSON.stringify(data, replacer);
|
12600
12645
|
var blob = new Blob([payload], {
|
12601
12646
|
type: "text/plain"
|
12602
12647
|
});
|
@@ -12690,7 +12735,7 @@
|
|
12690
12735
|
message.sentAt = getCurrentTimeFormatted(); // add this, will get modified when actually being sent
|
12691
12736
|
// check message size, if greater log an error
|
12692
12737
|
|
12693
|
-
if (JSON.stringify(message).length > MESSAGE_LENGTH) {
|
12738
|
+
if (JSON.stringify(message, replacer).length > MESSAGE_LENGTH) {
|
12694
12739
|
logger.error("[EventRepository] enqueue:: message length greater 32 Kb ", message);
|
12695
12740
|
}
|
12696
12741
|
|
@@ -12703,37 +12748,6 @@
|
|
12703
12748
|
|
12704
12749
|
var eventRepository = new EventRepository();
|
12705
12750
|
|
12706
|
-
/* eslint-disable no-use-before-define */
|
12707
|
-
// import logger from "../utils/logUtil";
|
12708
|
-
var defaultAsyncState = true;
|
12709
|
-
|
12710
|
-
var ScriptLoader = function ScriptLoader(id, src) {
|
12711
|
-
var async = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultAsyncState;
|
12712
|
-
var exists = document.getElementById(id);
|
12713
|
-
|
12714
|
-
if (exists) {
|
12715
|
-
// logger.debug("script already loaded");
|
12716
|
-
return;
|
12717
|
-
}
|
12718
|
-
|
12719
|
-
var js = document.createElement("script");
|
12720
|
-
js.src = src;
|
12721
|
-
js.async = async === undefined ? defaultAsyncState : async;
|
12722
|
-
js.type = "text/javascript";
|
12723
|
-
js.id = id;
|
12724
|
-
var headElmColl = document.getElementsByTagName("head");
|
12725
|
-
|
12726
|
-
if (headElmColl.length !== 0) {
|
12727
|
-
// logger.debug("==adding script==", js);
|
12728
|
-
headElmColl[0].insertBefore(js, headElmColl[0].firstChild);
|
12729
|
-
} else {
|
12730
|
-
var e = document.getElementsByTagName("script")[0]; // logger.debug("==parent script==", e);
|
12731
|
-
// logger.debug("==adding script==", js);
|
12732
|
-
|
12733
|
-
e.parentNode.insertBefore(js, e);
|
12734
|
-
}
|
12735
|
-
};
|
12736
|
-
|
12737
12751
|
/**
|
12738
12752
|
* @description This is utility function for crc32 algorithm
|
12739
12753
|
* @version v1.0.0
|
@@ -13151,6 +13165,106 @@
|
|
13151
13165
|
return CookieConsentFactory;
|
13152
13166
|
}();
|
13153
13167
|
|
13168
|
+
var META_DATA = {
|
13169
|
+
SDK: {
|
13170
|
+
name: "JS",
|
13171
|
+
installType: "npm"
|
13172
|
+
}
|
13173
|
+
}; // This API key token is parsed in the CI pipeline
|
13174
|
+
|
13175
|
+
var API_KEY = "{{RS_BUGSNAG_API_KEY}}"; // Errors only from Below SDKs are allowed to reach Bugsnag
|
13176
|
+
|
13177
|
+
var SDK_FILE_NAMES = ["browser.js", "rudder-analytics.min.js", "rudder-analytics-staging.min.js", "rudder-analytics.js"].concat(_toConsumableArray(Object.values(configToIntNames).map(function (intgName) {
|
13178
|
+
return "".concat(intgName, ".js");
|
13179
|
+
})), _toConsumableArray(Object.values(configToIntNames).map(function (intgName) {
|
13180
|
+
return "".concat(intgName, ".min.js");
|
13181
|
+
})), _toConsumableArray(Object.values(configToIntNames).map(function (intgName) {
|
13182
|
+
return "".concat(intgName, "-staging.min.js");
|
13183
|
+
})));
|
13184
|
+
/**
|
13185
|
+
* This function will load the Bugsnag native SDK through CDN
|
13186
|
+
* Once loaded it will be available in window.Bugsnag
|
13187
|
+
*/
|
13188
|
+
|
13189
|
+
var load$1 = function load() {
|
13190
|
+
var pluginName = "bugsnag";
|
13191
|
+
|
13192
|
+
if (!window.hasOwnProperty(pluginName)) {
|
13193
|
+
ScriptLoader(pluginName, "https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js");
|
13194
|
+
}
|
13195
|
+
};
|
13196
|
+
/**
|
13197
|
+
* This function is to initialize the bugsnag with apiKey, SDK meta data
|
13198
|
+
* and custom configuration for onError method.
|
13199
|
+
* After initialization Bugsnag instance will be available in window.rsBugsnagClient
|
13200
|
+
* @param {string} sourceId
|
13201
|
+
*/
|
13202
|
+
|
13203
|
+
|
13204
|
+
function initClient(sourceId) {
|
13205
|
+
if (window.Bugsnag === undefined) return; // If the API key token is not parsed yet, don't proceed to initialize the client
|
13206
|
+
// This also prevents unnecessary errors sent to Bugsnag during development phase.
|
13207
|
+
|
13208
|
+
var apiKeyRegex = /{{.+}}/;
|
13209
|
+
if (API_KEY.match(apiKeyRegex) !== null) return;
|
13210
|
+
window.rsBugsnagClient = window.Bugsnag.start({
|
13211
|
+
apiKey: API_KEY,
|
13212
|
+
appVersion: "2.8.0",
|
13213
|
+
// Set SDK version as the app version
|
13214
|
+
metadata: META_DATA,
|
13215
|
+
onError: function onError(event) {
|
13216
|
+
var errorOrigin = getValue(event.errors[0], "stacktrace.0.file"); // Skip errors that do not have a valid stack trace
|
13217
|
+
|
13218
|
+
if (!errorOrigin || typeof errorOrigin !== "string") return false;
|
13219
|
+
var srcFileName = errorOrigin.substring(errorOrigin.lastIndexOf("/") + 1);
|
13220
|
+
if (!SDK_FILE_NAMES.includes(srcFileName)) // Discard the event if it's not originated at the SDK
|
13221
|
+
return false;
|
13222
|
+
event.addMetadata("source", {
|
13223
|
+
sourceId: sourceId
|
13224
|
+
});
|
13225
|
+
var errMsg = event.errors[0].errorMessage;
|
13226
|
+
event.context = errMsg; // Hack for easily grouping the script load errors
|
13227
|
+
// on the dashboard
|
13228
|
+
|
13229
|
+
if (errMsg.includes("error in script loading")) event.context = "Script load failures";
|
13230
|
+
event.severity = "error";
|
13231
|
+
return true;
|
13232
|
+
},
|
13233
|
+
autoTrackSessions: false,
|
13234
|
+
// auto tracking sessions is disabled
|
13235
|
+
collectUserIp: false,
|
13236
|
+
// collecting user's IP is disabled
|
13237
|
+
enabledBreadcrumbTypes: ["error", "log", "user"]
|
13238
|
+
});
|
13239
|
+
window.rsBugsnagClient.releaseStage = "production"; // set the release stage
|
13240
|
+
}
|
13241
|
+
/**
|
13242
|
+
* The responsibility of this function is to check Bugsnag native SDK
|
13243
|
+
* has been loaded or not in a certain interval.
|
13244
|
+
* If already loaded initialize the SDK.
|
13245
|
+
* @param {*} sourceId
|
13246
|
+
*/
|
13247
|
+
|
13248
|
+
|
13249
|
+
var init = function init(sourceId) {
|
13250
|
+
if (window.hasOwnProperty("rsBugsnagClient")) return; // return if already initialized
|
13251
|
+
|
13252
|
+
if (window.Bugsnag !== undefined) {
|
13253
|
+
initClient(sourceId);
|
13254
|
+
} else {
|
13255
|
+
// Check if Bugsnag is loaded every '100'ms
|
13256
|
+
var interval = setInterval(function () {
|
13257
|
+
if (window.Bugsnag !== undefined) {
|
13258
|
+
clearInterval(interval);
|
13259
|
+
initClient(sourceId);
|
13260
|
+
}
|
13261
|
+
}, 100);
|
13262
|
+
setTimeout(function () {
|
13263
|
+
clearInterval(interval);
|
13264
|
+
}, MAX_WAIT_FOR_INTEGRATION_LOAD);
|
13265
|
+
}
|
13266
|
+
};
|
13267
|
+
|
13154
13268
|
/**
|
13155
13269
|
* class responsible for handling core
|
13156
13270
|
* event tracking functionalities
|
@@ -13180,7 +13294,7 @@
|
|
13180
13294
|
|
13181
13295
|
this.readyCallbacks = [];
|
13182
13296
|
this.methodToCallbackMapping = {
|
13183
|
-
syncPixel:
|
13297
|
+
syncPixel: 'syncPixelCallback'
|
13184
13298
|
};
|
13185
13299
|
this.loaded = false;
|
13186
13300
|
this.loadIntegration = true;
|
@@ -13200,11 +13314,11 @@
|
|
13200
13314
|
key: "initializeUser",
|
13201
13315
|
value: function initializeUser(anonymousIdOptions) {
|
13202
13316
|
// save once for storing older values to encrypted
|
13203
|
-
this.userId = this.storage.getUserId() ||
|
13317
|
+
this.userId = this.storage.getUserId() || '';
|
13204
13318
|
this.storage.setUserId(this.userId);
|
13205
13319
|
this.userTraits = this.storage.getUserTraits() || {};
|
13206
13320
|
this.storage.setUserTraits(this.userTraits);
|
13207
|
-
this.groupId = this.storage.getGroupId() ||
|
13321
|
+
this.groupId = this.storage.getGroupId() || '';
|
13208
13322
|
this.storage.setGroupId(this.groupId);
|
13209
13323
|
this.groupTraits = this.storage.getGroupTraits() || {};
|
13210
13324
|
this.storage.setGroupTraits(this.groupTraits);
|
@@ -13276,8 +13390,26 @@
|
|
13276
13390
|
|
13277
13391
|
try {
|
13278
13392
|
// logger.debug(`===in process response=== ${status}`)
|
13279
|
-
if (typeof response ===
|
13393
|
+
if (typeof response === 'string') {
|
13280
13394
|
response = JSON.parse(response);
|
13395
|
+
} // Fetch Error reporting enable option from sourceConfig
|
13396
|
+
|
13397
|
+
|
13398
|
+
var isErrorReportEnabled = getValue(response.source.config, 'statsCollection.errorReports.enabled'); // Load Bugsnag only if it is enabled in the source config
|
13399
|
+
|
13400
|
+
if (isErrorReportEnabled === true) {
|
13401
|
+
// Fetch the name of the Error reporter from sourceConfig
|
13402
|
+
var provider = getValue(response.source.config, 'statsCollection.errorReports.provider') || DEFAULT_ERROR_REPORT_PROVIDER;
|
13403
|
+
|
13404
|
+
if (!ERROR_REPORT_PROVIDERS.includes(provider)) {
|
13405
|
+
logger.error('Invalid error reporting provider value');
|
13406
|
+
}
|
13407
|
+
|
13408
|
+
if (provider === 'bugsnag') {
|
13409
|
+
// Load Bugsnag client SDK
|
13410
|
+
load$1();
|
13411
|
+
init(response.source.id);
|
13412
|
+
}
|
13281
13413
|
}
|
13282
13414
|
|
13283
13415
|
response.source.destinations.forEach(function (destination, index) {
|
@@ -13306,11 +13438,11 @@
|
|
13306
13438
|
cookieConsent && cookieConsent.isEnabled(intg.config);
|
13307
13439
|
});
|
13308
13440
|
} catch (e) {
|
13309
|
-
|
13441
|
+
handleError(e);
|
13310
13442
|
}
|
13311
13443
|
}
|
13312
13444
|
|
13313
|
-
var suffix =
|
13445
|
+
var suffix = ''; // default suffix
|
13314
13446
|
// Get the CDN base URL is rudder staging url
|
13315
13447
|
|
13316
13448
|
var _checkSDKUrl = checkSDKUrl(),
|
@@ -13318,10 +13450,11 @@
|
|
13318
13450
|
staging = _checkSDKUrl.staging;
|
13319
13451
|
|
13320
13452
|
if (rudderSDK && staging) {
|
13321
|
-
suffix =
|
13322
|
-
}
|
13323
|
-
// Load all the client integrations dynamically
|
13453
|
+
suffix = '-staging'; // stagging suffix
|
13454
|
+
}
|
13324
13455
|
|
13456
|
+
leaveBreadcrumb('Starting device-mode initialization'); // logger.debug("this.clientIntegrations: ", this.clientIntegrations)
|
13457
|
+
// Load all the client integrations dynamically
|
13325
13458
|
|
13326
13459
|
this.clientIntegrations.forEach(function (intg) {
|
13327
13460
|
var modName = configToIntNames[intg.name]; // script URL can be constructed from this
|
@@ -13343,10 +13476,9 @@
|
|
13343
13476
|
var intgInstance;
|
13344
13477
|
|
13345
13478
|
try {
|
13346
|
-
// logger.debug(
|
13347
|
-
|
13348
|
-
|
13349
|
-
// );
|
13479
|
+
var msg = "[Analytics] processResponse :: trying to initialize integration name:: ".concat(pluginName); // logger.debug(msg);
|
13480
|
+
|
13481
|
+
leaveBreadcrumb(msg);
|
13350
13482
|
intgInstance = new intMod[modName](intg.config, self);
|
13351
13483
|
intgInstance.init(); // logger.debug(pluginName, " initializing destination");
|
13352
13484
|
|
@@ -13355,7 +13487,8 @@
|
|
13355
13487
|
self.dynamicallyLoadedIntegrations[pluginName] = intMod[modName];
|
13356
13488
|
});
|
13357
13489
|
} catch (e) {
|
13358
|
-
|
13490
|
+
e.message = "[Analytics] 'integration.init()' failed :: ".concat(pluginName, " :: ").concat(e.message);
|
13491
|
+
handleError(e);
|
13359
13492
|
self.failedToBeLoadedIntegration.push(intgInstance);
|
13360
13493
|
}
|
13361
13494
|
}
|
@@ -13394,7 +13527,8 @@
|
|
13394
13527
|
// " failed loaded count: ",
|
13395
13528
|
// object.failedToBeLoadedIntegration.length
|
13396
13529
|
// );
|
13397
|
-
// eslint-disable-next-line no-param-reassign
|
13530
|
+
leaveBreadcrumb("Started replaying buffered events"); // eslint-disable-next-line no-param-reassign
|
13531
|
+
|
13398
13532
|
object.clientIntegrationObjects = []; // eslint-disable-next-line no-param-reassign
|
13399
13533
|
|
13400
13534
|
object.clientIntegrationObjects = object.successfullyLoadedIntegration; // logger.debug(
|
@@ -13498,19 +13632,20 @@
|
|
13498
13632
|
}, {
|
13499
13633
|
key: "page",
|
13500
13634
|
value: function page(category, name, properties, options, callback) {
|
13635
|
+
leaveBreadcrumb("Page event");
|
13501
13636
|
if (!this.loaded) return;
|
13502
|
-
if (typeof options ===
|
13503
|
-
if (typeof properties ===
|
13504
|
-
if (typeof name ===
|
13505
|
-
if (_typeof(category) ===
|
13506
|
-
if (_typeof(name) ===
|
13507
|
-
if (typeof category ===
|
13508
|
-
|
13509
|
-
if (this.sendAdblockPage && category !=
|
13637
|
+
if (typeof options === 'function') callback = options, options = null;
|
13638
|
+
if (typeof properties === 'function') callback = properties, options = properties = null;
|
13639
|
+
if (typeof name === 'function') callback = name, options = properties = name = null;
|
13640
|
+
if (_typeof(category) === 'object' && category != null && category != undefined) options = name, properties = category, name = category = null;
|
13641
|
+
if (_typeof(name) === 'object' && name != null && name != undefined) options = properties, properties = name, name = null;
|
13642
|
+
if (typeof category === 'string' && typeof name !== 'string') name = category, category = null;
|
13643
|
+
|
13644
|
+
if (this.sendAdblockPage && category != 'RudderJS-Initiated') {
|
13510
13645
|
this.sendSampleRequest();
|
13511
13646
|
}
|
13512
13647
|
|
13513
|
-
var rudderElement = new RudderElementBuilder().setType(
|
13648
|
+
var rudderElement = new RudderElementBuilder().setType('page').build();
|
13514
13649
|
|
13515
13650
|
if (!properties) {
|
13516
13651
|
properties = {};
|
@@ -13525,7 +13660,7 @@
|
|
13525
13660
|
}
|
13526
13661
|
|
13527
13662
|
rudderElement.message.properties = this.getPageProperties(properties);
|
13528
|
-
this.processAndSendDataToDestinations(
|
13663
|
+
this.processAndSendDataToDestinations('page', rudderElement, options, callback);
|
13529
13664
|
}
|
13530
13665
|
/**
|
13531
13666
|
* Process track params and forward to track call
|
@@ -13540,17 +13675,18 @@
|
|
13540
13675
|
}, {
|
13541
13676
|
key: "track",
|
13542
13677
|
value: function track(event, properties, options, callback) {
|
13678
|
+
leaveBreadcrumb("Track event");
|
13543
13679
|
if (!this.loaded) return;
|
13544
|
-
if (typeof options ===
|
13545
|
-
if (typeof properties ===
|
13546
|
-
var rudderElement = new RudderElementBuilder().setType(
|
13680
|
+
if (typeof options === 'function') callback = options, options = null;
|
13681
|
+
if (typeof properties === 'function') callback = properties, options = null, properties = null;
|
13682
|
+
var rudderElement = new RudderElementBuilder().setType('track').build();
|
13547
13683
|
|
13548
13684
|
if (event) {
|
13549
13685
|
rudderElement.setEventName(event);
|
13550
13686
|
}
|
13551
13687
|
|
13552
13688
|
rudderElement.setProperty(properties || {});
|
13553
|
-
this.processAndSendDataToDestinations(
|
13689
|
+
this.processAndSendDataToDestinations('track', rudderElement, options, callback);
|
13554
13690
|
}
|
13555
13691
|
/**
|
13556
13692
|
* Process identify params and forward to identify call
|
@@ -13565,10 +13701,11 @@
|
|
13565
13701
|
}, {
|
13566
13702
|
key: "identify",
|
13567
13703
|
value: function identify(userId, traits, options, callback) {
|
13704
|
+
leaveBreadcrumb("Identify event");
|
13568
13705
|
if (!this.loaded) return;
|
13569
|
-
if (typeof options ===
|
13570
|
-
if (typeof traits ===
|
13571
|
-
if (_typeof(userId) ===
|
13706
|
+
if (typeof options === 'function') callback = options, options = null;
|
13707
|
+
if (typeof traits === 'function') callback = traits, options = null, traits = null;
|
13708
|
+
if (_typeof(userId) === 'object') options = traits, traits = userId, userId = this.userId;
|
13572
13709
|
|
13573
13710
|
if (userId && this.userId && userId !== this.userId) {
|
13574
13711
|
this.reset();
|
@@ -13585,8 +13722,8 @@
|
|
13585
13722
|
this.storage.setUserTraits(this.userTraits);
|
13586
13723
|
}
|
13587
13724
|
|
13588
|
-
var rudderElement = new RudderElementBuilder().setType(
|
13589
|
-
this.processAndSendDataToDestinations(
|
13725
|
+
var rudderElement = new RudderElementBuilder().setType('identify').build();
|
13726
|
+
this.processAndSendDataToDestinations('identify', rudderElement, options, callback);
|
13590
13727
|
}
|
13591
13728
|
/**
|
13592
13729
|
*
|
@@ -13599,14 +13736,15 @@
|
|
13599
13736
|
}, {
|
13600
13737
|
key: "alias",
|
13601
13738
|
value: function alias(to, from, options, callback) {
|
13739
|
+
leaveBreadcrumb("Alias event");
|
13602
13740
|
if (!this.loaded) return;
|
13603
|
-
if (typeof options ===
|
13604
|
-
if (typeof from ===
|
13605
|
-
if (_typeof(from) ===
|
13606
|
-
var rudderElement = new RudderElementBuilder().setType(
|
13741
|
+
if (typeof options === 'function') callback = options, options = null;
|
13742
|
+
if (typeof from === 'function') callback = from, options = null, from = null;
|
13743
|
+
if (_typeof(from) === 'object') options = from, from = null;
|
13744
|
+
var rudderElement = new RudderElementBuilder().setType('alias').build();
|
13607
13745
|
rudderElement.message.previousId = from || (this.userId ? this.userId : this.getAnonymousId());
|
13608
13746
|
rudderElement.message.userId = to;
|
13609
|
-
this.processAndSendDataToDestinations(
|
13747
|
+
this.processAndSendDataToDestinations('alias', rudderElement, options, callback);
|
13610
13748
|
}
|
13611
13749
|
/**
|
13612
13750
|
*
|
@@ -13619,14 +13757,15 @@
|
|
13619
13757
|
}, {
|
13620
13758
|
key: "group",
|
13621
13759
|
value: function group(groupId, traits, options, callback) {
|
13760
|
+
leaveBreadcrumb("Group event");
|
13622
13761
|
if (!this.loaded) return;
|
13623
13762
|
if (!arguments.length) return;
|
13624
|
-
if (typeof options ===
|
13625
|
-
if (typeof traits ===
|
13626
|
-
if (_typeof(groupId) ===
|
13763
|
+
if (typeof options === 'function') callback = options, options = null;
|
13764
|
+
if (typeof traits === 'function') callback = traits, options = null, traits = null;
|
13765
|
+
if (_typeof(groupId) === 'object') options = traits, traits = groupId, groupId = this.groupId;
|
13627
13766
|
this.groupId = groupId;
|
13628
13767
|
this.storage.setGroupId(this.groupId);
|
13629
|
-
var rudderElement = new RudderElementBuilder().setType(
|
13768
|
+
var rudderElement = new RudderElementBuilder().setType('group').build();
|
13630
13769
|
|
13631
13770
|
if (traits) {
|
13632
13771
|
for (var key in traits) {
|
@@ -13637,12 +13776,12 @@
|
|
13637
13776
|
}
|
13638
13777
|
|
13639
13778
|
this.storage.setGroupTraits(this.groupTraits);
|
13640
|
-
this.processAndSendDataToDestinations(
|
13779
|
+
this.processAndSendDataToDestinations('group', rudderElement, options, callback);
|
13641
13780
|
}
|
13642
13781
|
}, {
|
13643
13782
|
key: "IsEventBlackListed",
|
13644
13783
|
value: function IsEventBlackListed(eventName, intgName) {
|
13645
|
-
if (!eventName || !(typeof eventName ===
|
13784
|
+
if (!eventName || !(typeof eventName === 'string')) {
|
13646
13785
|
return false;
|
13647
13786
|
}
|
13648
13787
|
|
@@ -13663,30 +13802,29 @@
|
|
13663
13802
|
|
13664
13803
|
switch (eventFilteringOption) {
|
13665
13804
|
// disabled filtering
|
13666
|
-
case
|
13805
|
+
case 'disable':
|
13667
13806
|
return false;
|
13668
13807
|
// Blacklist is choosen for filtering events
|
13669
13808
|
|
13670
|
-
case
|
13809
|
+
case 'blacklistedEvents':
|
13671
13810
|
if (Array.isArray(blacklistedEvents)) {
|
13672
13811
|
return blacklistedEvents.find(function (eventObj) {
|
13673
13812
|
return eventObj.eventName.trim().toUpperCase() === formattedEventName;
|
13674
|
-
})
|
13675
|
-
} else {
|
13676
|
-
return false;
|
13813
|
+
}) !== undefined;
|
13677
13814
|
}
|
13678
13815
|
|
13816
|
+
return false;
|
13679
13817
|
// Whitelist is choosen for filtering events
|
13680
13818
|
|
13681
|
-
case
|
13819
|
+
case 'whitelistedEvents':
|
13682
13820
|
if (Array.isArray(whitelistedEvents)) {
|
13683
13821
|
return whitelistedEvents.find(function (eventObj) {
|
13684
13822
|
return eventObj.eventName.trim().toUpperCase() === formattedEventName;
|
13685
|
-
}) === undefined
|
13686
|
-
} else {
|
13687
|
-
return true;
|
13823
|
+
}) === undefined;
|
13688
13824
|
}
|
13689
13825
|
|
13826
|
+
return true;
|
13827
|
+
|
13690
13828
|
default:
|
13691
13829
|
return false;
|
13692
13830
|
}
|
@@ -13712,12 +13850,13 @@
|
|
13712
13850
|
// rudderElement.message.context.page = getDefaultPageProperties();
|
13713
13851
|
|
13714
13852
|
|
13853
|
+
leaveBreadcrumb('Started sending data to destinations');
|
13715
13854
|
rudderElement.message.context.traits = _objectSpread2({}, this.userTraits); // logger.debug("anonymousId: ", this.anonymousId)
|
13716
13855
|
|
13717
13856
|
rudderElement.message.anonymousId = this.anonymousId;
|
13718
13857
|
rudderElement.message.userId = rudderElement.message.userId ? rudderElement.message.userId : this.userId;
|
13719
13858
|
|
13720
|
-
if (type ==
|
13859
|
+
if (type == 'group') {
|
13721
13860
|
if (this.groupId) {
|
13722
13861
|
rudderElement.message.groupId = this.groupId;
|
13723
13862
|
}
|
@@ -13746,8 +13885,8 @@
|
|
13746
13885
|
|
13747
13886
|
var succesfulLoadedIntersectClientSuppliedIntegrations = findAllEnabledDestinations(clientSuppliedIntegrations, this.clientIntegrationObjects); // try to first send to all integrations, if list populated from BE
|
13748
13887
|
|
13749
|
-
|
13750
|
-
|
13888
|
+
succesfulLoadedIntersectClientSuppliedIntegrations.forEach(function (obj) {
|
13889
|
+
try {
|
13751
13890
|
if (!obj.isFailed || !obj.isFailed()) {
|
13752
13891
|
if (obj[type]) {
|
13753
13892
|
var sendEvent = !_this4.IsEventBlackListed(rudderElement.message.event, obj.name); // Block the event if it is blacklisted for the device-mode destination
|
@@ -13758,12 +13897,11 @@
|
|
13758
13897
|
}
|
13759
13898
|
}
|
13760
13899
|
}
|
13761
|
-
})
|
13762
|
-
|
13763
|
-
|
13764
|
-
|
13765
|
-
|
13766
|
-
}
|
13900
|
+
} catch (err) {
|
13901
|
+
err.message = "[sendToNative]::[Destination:".concat(obj.name, "]:: ").concat(err);
|
13902
|
+
handleError(err);
|
13903
|
+
}
|
13904
|
+
});
|
13767
13905
|
} // convert integrations object to server identified names, kind of hack now!
|
13768
13906
|
|
13769
13907
|
|
@@ -13782,20 +13920,20 @@
|
|
13782
13920
|
key: "utm",
|
13783
13921
|
value: function utm(query) {
|
13784
13922
|
// Remove leading ? if present
|
13785
|
-
if (query.charAt(0) ===
|
13923
|
+
if (query.charAt(0) === '?') {
|
13786
13924
|
query = query.substring(1);
|
13787
13925
|
}
|
13788
13926
|
|
13789
|
-
query = query.replace(/\?/g,
|
13927
|
+
query = query.replace(/\?/g, '&');
|
13790
13928
|
var param;
|
13791
13929
|
var params = parse$6(query);
|
13792
13930
|
var results = {};
|
13793
13931
|
|
13794
13932
|
for (var key in params) {
|
13795
13933
|
if (Object.prototype.hasOwnProperty.call(params, key)) {
|
13796
|
-
if (key.substr(0, 4) ===
|
13934
|
+
if (key.substr(0, 4) === 'utm_') {
|
13797
13935
|
param = key.substr(4);
|
13798
|
-
if (param ===
|
13936
|
+
if (param === 'campaign') param = 'name';
|
13799
13937
|
results[param] = params[key];
|
13800
13938
|
}
|
13801
13939
|
}
|
@@ -13813,7 +13951,7 @@
|
|
13813
13951
|
value: function addCampaignInfo(rudderElement) {
|
13814
13952
|
var msgContext = rudderElement.message.context;
|
13815
13953
|
|
13816
|
-
if (msgContext && _typeof(msgContext) ===
|
13954
|
+
if (msgContext && _typeof(msgContext) === 'object') {
|
13817
13955
|
var _getDefaultPageProper = getDefaultPageProperties(),
|
13818
13956
|
search = _getDefaultPageProper.search;
|
13819
13957
|
|
@@ -13839,18 +13977,18 @@
|
|
13839
13977
|
properties = _rudderElement$messag.properties;
|
13840
13978
|
this.addCampaignInfo(rudderElement); // assign page properties to context.page
|
13841
13979
|
|
13842
|
-
rudderElement.message.context.page = this.getContextPageProperties(type ===
|
13843
|
-
var topLevelElements = [
|
13980
|
+
rudderElement.message.context.page = this.getContextPageProperties(type === 'page' ? properties : undefined);
|
13981
|
+
var topLevelElements = ['integrations', 'anonymousId', 'originalTimestamp'];
|
13844
13982
|
|
13845
13983
|
for (var key in options) {
|
13846
13984
|
if (topLevelElements.includes(key)) {
|
13847
13985
|
rudderElement.message[key] = options[key];
|
13848
|
-
} else if (key !==
|
13986
|
+
} else if (key !== 'context') {
|
13849
13987
|
rudderElement.message.context = merge(rudderElement.message.context, _defineProperty({}, key, options[key]));
|
13850
|
-
} else if (_typeof(options[key]) ===
|
13988
|
+
} else if (_typeof(options[key]) === 'object' && options[key] != null) {
|
13851
13989
|
rudderElement.message.context = merge(rudderElement.message.context, _objectSpread2({}, options[key]));
|
13852
13990
|
} else {
|
13853
|
-
logger.error(
|
13991
|
+
logger.error('[Analytics: processOptionsParam] context passed in options is not object');
|
13854
13992
|
}
|
13855
13993
|
}
|
13856
13994
|
}
|
@@ -13890,15 +14028,16 @@
|
|
13890
14028
|
}, {
|
13891
14029
|
key: "reset",
|
13892
14030
|
value: function reset(flag) {
|
14031
|
+
leaveBreadcrumb("reset API :: flag: ".concat(flag));
|
13893
14032
|
if (!this.loaded) return;
|
13894
14033
|
|
13895
14034
|
if (flag) {
|
13896
|
-
this.anonymousId =
|
14035
|
+
this.anonymousId = '';
|
13897
14036
|
}
|
13898
14037
|
|
13899
|
-
this.userId =
|
14038
|
+
this.userId = '';
|
13900
14039
|
this.userTraits = {};
|
13901
|
-
this.groupId =
|
14040
|
+
this.groupId = '';
|
13902
14041
|
this.groupTraits = {};
|
13903
14042
|
this.storage.clear(flag);
|
13904
14043
|
}
|
@@ -13957,7 +14096,7 @@
|
|
13957
14096
|
}, {
|
13958
14097
|
key: "isValidWriteKey",
|
13959
14098
|
value: function isValidWriteKey(writeKey) {
|
13960
|
-
if (!writeKey || typeof writeKey !==
|
14099
|
+
if (!writeKey || typeof writeKey !== 'string' || writeKey.trim().length == 0) {
|
13961
14100
|
return false;
|
13962
14101
|
}
|
13963
14102
|
|
@@ -13966,7 +14105,7 @@
|
|
13966
14105
|
}, {
|
13967
14106
|
key: "isValidServerUrl",
|
13968
14107
|
value: function isValidServerUrl(serverUrl) {
|
13969
|
-
if (!serverUrl || typeof serverUrl !==
|
14108
|
+
if (!serverUrl || typeof serverUrl !== 'string' || serverUrl.trim().length == 0) {
|
13970
14109
|
return false;
|
13971
14110
|
}
|
13972
14111
|
|
@@ -13991,16 +14130,13 @@
|
|
13991
14130
|
}
|
13992
14131
|
|
13993
14132
|
if (!this.storage || Object.keys(this.storage).length === 0) {
|
13994
|
-
throw Error(
|
14133
|
+
throw Error('Cannot proceed as no storage is available');
|
13995
14134
|
}
|
13996
14135
|
|
13997
14136
|
if (options && options.cookieConsentManager) this.cookieConsentOptions = cloneDeep(options.cookieConsentManager);
|
13998
14137
|
|
13999
14138
|
if (!this.isValidWriteKey(writeKey) || !this.isValidServerUrl(serverUrl)) {
|
14000
|
-
|
14001
|
-
message: "[Analytics] load:: Unable to load due to invalid writeKey or serverUrl"
|
14002
|
-
});
|
14003
|
-
throw Error("failed to initialize");
|
14139
|
+
throw Error('Unable to load the SDK due to invalid writeKey or serverUrl');
|
14004
14140
|
}
|
14005
14141
|
|
14006
14142
|
var storageOptions = {};
|
@@ -14029,7 +14165,7 @@
|
|
14029
14165
|
this.sendAdblockPage = true;
|
14030
14166
|
}
|
14031
14167
|
|
14032
|
-
if (options && options.sendAdblockPageOptions && _typeof(options.sendAdblockPageOptions) ===
|
14168
|
+
if (options && options.sendAdblockPageOptions && _typeof(options.sendAdblockPageOptions) === 'object') {
|
14033
14169
|
this.sendAdblockPageOptions = options.sendAdblockPageOptions;
|
14034
14170
|
}
|
14035
14171
|
|
@@ -14067,9 +14203,9 @@
|
|
14067
14203
|
|
14068
14204
|
if (!this.destSDKBaseURL) {
|
14069
14205
|
handleError({
|
14070
|
-
message:
|
14206
|
+
message: '[Analytics] load:: CDN base URL is not valid'
|
14071
14207
|
});
|
14072
|
-
throw Error(
|
14208
|
+
throw Error('failed to load');
|
14073
14209
|
}
|
14074
14210
|
} else {
|
14075
14211
|
// Get the CDN base URL from the included 'rudder-analytics.min.js' script tag
|
@@ -14077,13 +14213,13 @@
|
|
14077
14213
|
rudderSDK = _checkSDKUrl2.rudderSDK;
|
14078
14214
|
|
14079
14215
|
if (rudderSDK) {
|
14080
|
-
this.destSDKBaseURL = rudderSDK.split(
|
14216
|
+
this.destSDKBaseURL = rudderSDK.split('/').slice(0, -1).concat(CDN_INT_DIR).join('/');
|
14081
14217
|
}
|
14082
14218
|
}
|
14083
14219
|
|
14084
14220
|
if (options && options.getSourceConfig) {
|
14085
|
-
if (typeof options.getSourceConfig !==
|
14086
|
-
handleError('option "getSourceConfig" must be a function');
|
14221
|
+
if (typeof options.getSourceConfig !== 'function') {
|
14222
|
+
handleError(new Error('option "getSourceConfig" must be a function'));
|
14087
14223
|
} else {
|
14088
14224
|
var res = options.getSourceConfig();
|
14089
14225
|
|
@@ -14126,11 +14262,11 @@
|
|
14126
14262
|
// If not present dynamically load from the polyfill cdn
|
14127
14263
|
|
14128
14264
|
if (!String.prototype.endsWith || !String.prototype.startsWith || !String.prototype.includes || !Array.prototype.find || !Array.prototype.includes || !Promise || !Object.entries) {
|
14129
|
-
ScriptLoader(
|
14265
|
+
ScriptLoader('polyfill', POLYFILL_URL);
|
14130
14266
|
var self = this;
|
14131
14267
|
var interval = setInterval(function () {
|
14132
14268
|
// check if the polyfill is loaded
|
14133
|
-
if (window.hasOwnProperty(
|
14269
|
+
if (window.hasOwnProperty('polyfill')) {
|
14134
14270
|
clearInterval(interval);
|
14135
14271
|
self.loadAfterPolyfill(writeKey, serverUrl, options);
|
14136
14272
|
}
|
@@ -14147,7 +14283,7 @@
|
|
14147
14283
|
value: function ready(callback) {
|
14148
14284
|
if (!this.loaded) return;
|
14149
14285
|
|
14150
|
-
if (typeof callback ===
|
14286
|
+
if (typeof callback === 'function') {
|
14151
14287
|
/**
|
14152
14288
|
* If integrations are loaded or no integration is available for loading
|
14153
14289
|
* execute the callback immediately
|
@@ -14162,7 +14298,7 @@
|
|
14162
14298
|
return;
|
14163
14299
|
}
|
14164
14300
|
|
14165
|
-
logger.error(
|
14301
|
+
logger.error('ready callback is not a function');
|
14166
14302
|
}
|
14167
14303
|
}, {
|
14168
14304
|
key: "initializeCallbacks",
|
@@ -14184,7 +14320,7 @@
|
|
14184
14320
|
Object.keys(this.methodToCallbackMapping).forEach(function (methodName) {
|
14185
14321
|
if (_this7.methodToCallbackMapping.hasOwnProperty(methodName)) {
|
14186
14322
|
if (window.rudderanalytics) {
|
14187
|
-
if (typeof window.rudderanalytics[_this7.methodToCallbackMapping[methodName]] ===
|
14323
|
+
if (typeof window.rudderanalytics[_this7.methodToCallbackMapping[methodName]] === 'function') {
|
14188
14324
|
_this7.clientSuppliedCallbacks[methodName] = window.rudderanalytics[_this7.methodToCallbackMapping[methodName]];
|
14189
14325
|
}
|
14190
14326
|
} // let callback =
|
@@ -14215,7 +14351,7 @@
|
|
14215
14351
|
}, {
|
14216
14352
|
key: "sendSampleRequest",
|
14217
14353
|
value: function sendSampleRequest() {
|
14218
|
-
ScriptLoader(
|
14354
|
+
ScriptLoader('ad-block', '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js');
|
14219
14355
|
}
|
14220
14356
|
}]);
|
14221
14357
|
|
@@ -14243,8 +14379,8 @@
|
|
14243
14379
|
|
14244
14380
|
function parseQueryString(query) {
|
14245
14381
|
var queryDefaults = {
|
14246
|
-
trait:
|
14247
|
-
prop:
|
14382
|
+
trait: 'ajs_trait_',
|
14383
|
+
prop: 'ajs_prop_'
|
14248
14384
|
};
|
14249
14385
|
|
14250
14386
|
function getDataFromQueryObj(qObj, dataType) {
|
@@ -14260,33 +14396,33 @@
|
|
14260
14396
|
var queryObject = parse$6(query);
|
14261
14397
|
|
14262
14398
|
if (queryObject.ajs_aid) {
|
14263
|
-
instance.toBeProcessedArray.push([
|
14399
|
+
instance.toBeProcessedArray.push(['setAnonymousId', queryObject.ajs_aid]);
|
14264
14400
|
}
|
14265
14401
|
|
14266
14402
|
if (queryObject.ajs_uid) {
|
14267
|
-
instance.toBeProcessedArray.push([
|
14403
|
+
instance.toBeProcessedArray.push(['identify', queryObject.ajs_uid, getDataFromQueryObj(queryObject, queryDefaults.trait)]);
|
14268
14404
|
}
|
14269
14405
|
|
14270
14406
|
if (queryObject.ajs_event) {
|
14271
|
-
instance.toBeProcessedArray.push([
|
14407
|
+
instance.toBeProcessedArray.push(['track', queryObject.ajs_event, getDataFromQueryObj(queryObject, queryDefaults.prop)]);
|
14272
14408
|
}
|
14273
14409
|
}
|
14274
14410
|
|
14275
14411
|
Emitter$1(instance);
|
14276
|
-
window.addEventListener(
|
14412
|
+
window.addEventListener('error', function (e) {
|
14277
14413
|
handleError(e, instance);
|
14278
14414
|
}, true); // initialize supported callbacks
|
14279
14415
|
|
14280
14416
|
instance.initializeCallbacks(); // register supported callbacks
|
14281
14417
|
|
14282
14418
|
instance.registerCallbacks(false);
|
14283
|
-
var defaultMethod =
|
14419
|
+
var defaultMethod = 'load';
|
14284
14420
|
var argumentsArray = window.rudderanalytics;
|
14285
14421
|
var isValidArgsArray = Array.isArray(argumentsArray);
|
14286
14422
|
|
14287
14423
|
if (isValidArgsArray) {
|
14288
14424
|
/**
|
14289
|
-
* Iterate the buffered API calls until we find load call and
|
14425
|
+
* Iterate the buffered API calls until we find load call and
|
14290
14426
|
* queue it first for processing
|
14291
14427
|
*/
|
14292
14428
|
var i = 0;
|