@blotoutio/edgetag-sdk-browser 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +38 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -190,6 +190,43 @@
|
|
|
190
190
|
return '';
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
|
+
const getReferrer = () => {
|
|
194
|
+
let referrer = '';
|
|
195
|
+
try {
|
|
196
|
+
const referrerUrl = new URL(document.referrer);
|
|
197
|
+
if (referrerUrl.host !== window.location.host) {
|
|
198
|
+
referrer = referrerUrl.href;
|
|
199
|
+
}
|
|
200
|
+
return referrer;
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
return referrer;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const getPageUrl = () => {
|
|
207
|
+
try {
|
|
208
|
+
return window.location.href;
|
|
209
|
+
}
|
|
210
|
+
catch (_a) {
|
|
211
|
+
return '';
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
const getSearch = () => {
|
|
215
|
+
try {
|
|
216
|
+
return window.location.search;
|
|
217
|
+
}
|
|
218
|
+
catch (_a) {
|
|
219
|
+
return '';
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const getPageTitle = () => {
|
|
223
|
+
try {
|
|
224
|
+
return document.title;
|
|
225
|
+
}
|
|
226
|
+
catch (_a) {
|
|
227
|
+
return '';
|
|
228
|
+
}
|
|
229
|
+
};
|
|
193
230
|
const isProviderIncluded = (providers, providerValue) => {
|
|
194
231
|
return (providerValue || (providers['all'] === true && providerValue === undefined));
|
|
195
232
|
};
|
|
@@ -477,14 +514,7 @@
|
|
|
477
514
|
});
|
|
478
515
|
});
|
|
479
516
|
const getStandardPayload = (payload) => {
|
|
480
|
-
|
|
481
|
-
try {
|
|
482
|
-
pageUrl = window.location.href;
|
|
483
|
-
}
|
|
484
|
-
catch (_a) {
|
|
485
|
-
pageUrl = '';
|
|
486
|
-
}
|
|
487
|
-
const data = Object.assign({ pageUrl, userAgent: getUserAgent() }, (payload || {}));
|
|
517
|
+
const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch() }, (payload || {}));
|
|
488
518
|
let storage = {};
|
|
489
519
|
const session = getData$1('session');
|
|
490
520
|
if (session) {
|