@blotoutio/providers-rtb-house-sdk 1.46.1 → 1.47.2
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.cjs.js +14 -2
- package/index.js +14 -2
- package/index.mjs +14 -2
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -75,7 +75,18 @@ const ensureRtbh = () => {
|
|
|
75
75
|
};
|
|
76
76
|
const getOfferId = (item) => { var _a, _b, _c; return String((_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.variantId) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.id) !== null && _b !== void 0 ? _b : item === null || item === void 0 ? void 0 : item.sku) !== null && _c !== void 0 ? _c : 'unknown'); };
|
|
77
77
|
const getOfferIds = (items, limit = 5) => (Array.isArray(items) ? items : []).slice(0, limit).map((i) => getOfferId(i));
|
|
78
|
-
const
|
|
78
|
+
const getPathname = (pageUrl) => {
|
|
79
|
+
if (pageUrl) {
|
|
80
|
+
try {
|
|
81
|
+
return new URL(pageUrl).pathname;
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// fall through to browser API
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return window.location.pathname;
|
|
88
|
+
};
|
|
89
|
+
const tag = ({ data, eventName, userId, pageUrl }) => {
|
|
79
90
|
// RTB House: push events to `window.rtbhEvents` queue (ensure it's created)
|
|
80
91
|
const getUid = () => {
|
|
81
92
|
if (!userId) {
|
|
@@ -89,7 +100,8 @@ const tag = ({ data, eventName, userId }) => {
|
|
|
89
100
|
switch (eventName) {
|
|
90
101
|
case 'PageView':
|
|
91
102
|
{
|
|
92
|
-
const
|
|
103
|
+
const pathname = getPathname(pageUrl);
|
|
104
|
+
const isHome = pathname === '/' || pathname === '';
|
|
93
105
|
const page = isHome ? 'home' : 'placebo';
|
|
94
106
|
rtbh.push({ eventType: page }, { eventType: 'uid', id: uid });
|
|
95
107
|
}
|
package/index.js
CHANGED
|
@@ -76,7 +76,18 @@ var ProvidersRtbHouseSdk = (function () {
|
|
|
76
76
|
};
|
|
77
77
|
const getOfferId = (item) => { var _a, _b, _c; return String((_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.variantId) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.id) !== null && _b !== void 0 ? _b : item === null || item === void 0 ? void 0 : item.sku) !== null && _c !== void 0 ? _c : 'unknown'); };
|
|
78
78
|
const getOfferIds = (items, limit = 5) => (Array.isArray(items) ? items : []).slice(0, limit).map((i) => getOfferId(i));
|
|
79
|
-
const
|
|
79
|
+
const getPathname = (pageUrl) => {
|
|
80
|
+
if (pageUrl) {
|
|
81
|
+
try {
|
|
82
|
+
return new URL(pageUrl).pathname;
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// fall through to browser API
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return window.location.pathname;
|
|
89
|
+
};
|
|
90
|
+
const tag = ({ data, eventName, userId, pageUrl }) => {
|
|
80
91
|
// RTB House: push events to `window.rtbhEvents` queue (ensure it's created)
|
|
81
92
|
const getUid = () => {
|
|
82
93
|
if (!userId) {
|
|
@@ -90,7 +101,8 @@ var ProvidersRtbHouseSdk = (function () {
|
|
|
90
101
|
switch (eventName) {
|
|
91
102
|
case 'PageView':
|
|
92
103
|
{
|
|
93
|
-
const
|
|
104
|
+
const pathname = getPathname(pageUrl);
|
|
105
|
+
const isHome = pathname === '/' || pathname === '';
|
|
94
106
|
const page = isHome ? 'home' : 'placebo';
|
|
95
107
|
rtbh.push({ eventType: page }, { eventType: 'uid', id: uid });
|
|
96
108
|
}
|
package/index.mjs
CHANGED
|
@@ -73,7 +73,18 @@ const ensureRtbh = () => {
|
|
|
73
73
|
};
|
|
74
74
|
const getOfferId = (item) => { var _a, _b, _c; return String((_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.variantId) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.id) !== null && _b !== void 0 ? _b : item === null || item === void 0 ? void 0 : item.sku) !== null && _c !== void 0 ? _c : 'unknown'); };
|
|
75
75
|
const getOfferIds = (items, limit = 5) => (Array.isArray(items) ? items : []).slice(0, limit).map((i) => getOfferId(i));
|
|
76
|
-
const
|
|
76
|
+
const getPathname = (pageUrl) => {
|
|
77
|
+
if (pageUrl) {
|
|
78
|
+
try {
|
|
79
|
+
return new URL(pageUrl).pathname;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// fall through to browser API
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return window.location.pathname;
|
|
86
|
+
};
|
|
87
|
+
const tag = ({ data, eventName, userId, pageUrl }) => {
|
|
77
88
|
// RTB House: push events to `window.rtbhEvents` queue (ensure it's created)
|
|
78
89
|
const getUid = () => {
|
|
79
90
|
if (!userId) {
|
|
@@ -87,7 +98,8 @@ const tag = ({ data, eventName, userId }) => {
|
|
|
87
98
|
switch (eventName) {
|
|
88
99
|
case 'PageView':
|
|
89
100
|
{
|
|
90
|
-
const
|
|
101
|
+
const pathname = getPathname(pageUrl);
|
|
102
|
+
const isHome = pathname === '/' || pathname === '';
|
|
91
103
|
const page = isHome ? 'home' : 'placebo';
|
|
92
104
|
rtbh.push({ eventType: page }, { eventType: 'uid', id: uid });
|
|
93
105
|
}
|