pb-sxp-ui 1.15.34 → 1.15.36

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 CHANGED
@@ -993,6 +993,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
993
993
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
994
994
  return;
995
995
  }
996
+ let isPushState = false;
996
997
  const pixelEventParamsJson = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.pixel) === null || _a === void 0 ? void 0 : _a[eventName];
997
998
  if ((pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
998
999
  function updateQueryStringParameter(uri, key, value) {
@@ -1008,32 +1009,33 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1008
1009
  if (eventName === 'PageView' && (pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
1009
1010
  if (!pixelPvStatusRef.current) {
1010
1011
  pixelPvStatusRef.current = true;
1011
- return;
1012
1012
  }
1013
- const currentUrl = window.location.href;
1014
- const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
1015
- history.pushState({ path: newUrl }, '', newUrl);
1013
+ else {
1014
+ const currentUrl = window.location.href;
1015
+ const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
1016
+ history.pushState({ path: newUrl }, '', newUrl);
1017
+ isPushState = true;
1018
+ }
1016
1019
  }
1017
1020
  else {
1018
1021
  const body = getEventParamsByJson(pixelEventParamsJson);
1019
1022
  window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, body);
1020
- if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
1021
- window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
1022
- }
1023
1023
  }
1024
1024
  }
1025
- else if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
1026
- window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
1027
- }
1028
- const tiktokPixelEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.tiktokPixel) === null || _b === void 0 ? void 0 : _b[eventName];
1029
- if ((tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name) &&
1030
- typeof (window === null || window === void 0 ? void 0 : window.ttq) === 'object' &&
1031
- typeof ((_c = window === null || window === void 0 ? void 0 : window.ttq) === null || _c === void 0 ? void 0 : _c.track) === 'function') {
1032
- (_d = window === null || window === void 0 ? void 0 : window.ttq) === null || _d === void 0 ? void 0 : _d.track(tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name, tiktokPixelEventParamsJson);
1033
- }
1034
- const snapchatPixelEventParamsJson = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.snapchatPixel) === null || _e === void 0 ? void 0 : _e[eventName];
1035
- if ((snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.snaptr) === 'function') {
1036
- window === null || window === void 0 ? void 0 : window.snaptr('track', snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name, snapchatPixelEventParamsJson);
1025
+ if (!isPushState) {
1026
+ if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
1027
+ window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
1028
+ }
1029
+ const tiktokPixelEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.tiktokPixel) === null || _b === void 0 ? void 0 : _b[eventName];
1030
+ if ((tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name) &&
1031
+ typeof (window === null || window === void 0 ? void 0 : window.ttq) === 'object' &&
1032
+ typeof ((_c = window === null || window === void 0 ? void 0 : window.ttq) === null || _c === void 0 ? void 0 : _c.track) === 'function') {
1033
+ (_d = window === null || window === void 0 ? void 0 : window.ttq) === null || _d === void 0 ? void 0 : _d.track(tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name, tiktokPixelEventParamsJson);
1034
+ }
1035
+ const snapchatPixelEventParamsJson = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.snapchatPixel) === null || _e === void 0 ? void 0 : _e[eventName];
1036
+ if ((snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.snaptr) === 'function') {
1037
+ window === null || window === void 0 ? void 0 : window.snaptr('track', snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name, snapchatPixelEventParamsJson);
1038
+ }
1037
1039
  }
1038
1040
  const converApiEventParamsJson = (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _f === void 0 ? void 0 : _f[eventName];
1039
1041
  if (enabledMetaConversionApi && converApiEventParamsJson) {