pb-sxp-ui 1.16.15 → 1.16.16
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/dist/index.cjs +53 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +53 -32
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +53 -32
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/context/SxpDataSourceProvider.js +49 -29
- package/lib/core/context/SxpDataSourceProvider.js +49 -29
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
@@ -776,18 +776,18 @@
|
|
776
776
|
set(value) {
|
777
777
|
// 继续正常设置 src
|
778
778
|
originalSrcDescriptor.set.call(this, value);
|
779
|
-
img.onload = function () {
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
}
|
790
|
-
}
|
779
|
+
// img.onload = function () {
|
780
|
+
// 检查是否是目标 URL
|
781
|
+
if (value.includes('https://www.facebook.com/privacy_sandbox/pixel/register/trigger/')) {
|
782
|
+
// 解析 URL 参数
|
783
|
+
const url = new URL(value);
|
784
|
+
const params = Object.fromEntries(url.searchParams.entries());
|
785
|
+
bffCollectEvent({
|
786
|
+
eventName: params === null || params === void 0 ? void 0 : params.ev,
|
787
|
+
eventSource: 'Meta Pixel'
|
788
|
+
});
|
789
|
+
// }
|
790
|
+
}
|
791
791
|
},
|
792
792
|
get() {
|
793
793
|
return originalSrcDescriptor.get.call(this);
|
@@ -827,25 +827,23 @@
|
|
827
827
|
var _a, _b;
|
828
828
|
try {
|
829
829
|
const parsedData = yield parseBeaconData(data);
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
});
|
848
|
-
}
|
830
|
+
// 使用你的自定义上报方法
|
831
|
+
if (urlString.includes('https://tr.snapchat.com/p')) {
|
832
|
+
(_b = (_a = parsedData === null || parsedData === void 0 ? void 0 : parsedData.req) === null || _a === void 0 ? void 0 : _a.forEach) === null || _b === void 0 ? void 0 : _b.call(_a, (item) => {
|
833
|
+
var _a, _b;
|
834
|
+
if ((_a = item === null || item === void 0 ? void 0 : item.t) === null || _a === void 0 ? void 0 : _a.ev) {
|
835
|
+
bffCollectEvent({
|
836
|
+
eventName: (_b = item === null || item === void 0 ? void 0 : item.t) === null || _b === void 0 ? void 0 : _b.ev,
|
837
|
+
eventSource: 'Snapchat Pixel'
|
838
|
+
});
|
839
|
+
}
|
840
|
+
});
|
841
|
+
}
|
842
|
+
else if (urlString.includes('https://analytics.tiktok.com/api/v2/pixel') && (parsedData === null || parsedData === void 0 ? void 0 : parsedData.event)) {
|
843
|
+
bffCollectEvent({
|
844
|
+
eventName: parsedData.event,
|
845
|
+
eventSource: 'TikTok Pixel'
|
846
|
+
});
|
849
847
|
}
|
850
848
|
}
|
851
849
|
catch (error) {
|
@@ -867,6 +865,7 @@
|
|
867
865
|
window.fetch = function (input, init) {
|
868
866
|
var arguments_1 = arguments;
|
869
867
|
return __awaiter(this, void 0, void 0, function* () {
|
868
|
+
var _a;
|
870
869
|
// 安全获取 URL 字符串
|
871
870
|
let url;
|
872
871
|
try {
|
@@ -887,17 +886,39 @@
|
|
887
886
|
// 检查是否是 GA4 收集端点
|
888
887
|
try {
|
889
888
|
// 1. 先执行原始请求
|
890
|
-
const response =
|
889
|
+
const response = _originalFetch.apply(this, arguments_1);
|
891
890
|
// 2. 检查请求是否成功 (HTTP 200-299)
|
892
891
|
// 安全解析 URL
|
893
892
|
const urlObj = new URL(url);
|
894
893
|
const params = Object.fromEntries(urlObj.searchParams.entries());
|
894
|
+
const body = (_a = arguments_1[1]) === null || _a === void 0 ? void 0 : _a.body;
|
895
895
|
if (params === null || params === void 0 ? void 0 : params.en) {
|
896
896
|
bffCollectEvent({
|
897
897
|
eventName: params === null || params === void 0 ? void 0 : params.en,
|
898
898
|
eventSource: 'Google Analytics'
|
899
899
|
});
|
900
900
|
}
|
901
|
+
else if (body) {
|
902
|
+
function extractAllEnValuesSplit(queryString) {
|
903
|
+
if (typeof queryString !== 'string') {
|
904
|
+
return [];
|
905
|
+
}
|
906
|
+
const matches = [];
|
907
|
+
const regex = /en=([^&\r\n]*)/g;
|
908
|
+
let match;
|
909
|
+
while ((match = regex.exec(queryString)) !== null) {
|
910
|
+
matches.push(decodeURIComponent(match[1]));
|
911
|
+
}
|
912
|
+
return matches;
|
913
|
+
}
|
914
|
+
const enValues = extractAllEnValuesSplit(body);
|
915
|
+
enValues === null || enValues === void 0 ? void 0 : enValues.forEach((en) => {
|
916
|
+
bffCollectEvent({
|
917
|
+
eventName: en,
|
918
|
+
eventSource: 'Google Analytics'
|
919
|
+
});
|
920
|
+
});
|
921
|
+
}
|
901
922
|
return response;
|
902
923
|
}
|
903
924
|
catch (error) {
|