pb-sxp-ui 1.15.18 → 1.15.20-alpha.1

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.js CHANGED
@@ -723,15 +723,25 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
723
723
  }
724
724
  // 事件上报优化
725
725
  // Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
726
- if (options.type === 'beacon' && navigator.sendBeacon) {
727
- return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
728
- JSON.stringify({
729
- body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
730
- })
731
- ], {
732
- type: 'application/json;charset=UTF-8'
733
- }));
734
- }
726
+ // if (options.type === 'beacon' && navigator.sendBeacon) {
727
+ // return navigator.sendBeacon(
728
+ // `${url}/api/${path}`,
729
+ // new Blob(
730
+ // [
731
+ // JSON.stringify({
732
+ // body: btoa(
733
+ // encodeURIComponent(
734
+ // JSON.stringify({ ...options.body, ...bffDataSource.headers, 'x-user-id': fakeUserId })
735
+ // )
736
+ // )
737
+ // })
738
+ // ],
739
+ // {
740
+ // type: 'application/json;charset=UTF-8'
741
+ // }
742
+ // )
743
+ // );
744
+ // }
735
745
  return window
736
746
  .fetch(`${url}/api/${path}`, {
737
747
  headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
@@ -984,13 +994,18 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
984
994
  return uri + separator + key + '=' + value;
985
995
  }
986
996
  }
987
- if (eventName === 'PageView') {
997
+ if (eventName === 'PageView' && (pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
988
998
  const currentUrl = window.location.href;
989
999
  const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
990
1000
  history.pushState({ path: newUrl }, '', newUrl);
991
1001
  }
992
- const body = getEventParamsByJson(pixelEventParamsJson);
993
- window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, body);
1002
+ else {
1003
+ const body = getEventParamsByJson(pixelEventParamsJson);
1004
+ window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, body);
1005
+ if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
1006
+ window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
1007
+ }
1008
+ }
994
1009
  }
995
1010
  else if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
996
1011
  window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');