shopkit-analytics 1.0.13 → 1.0.14

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.
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  initTracking,
4
4
  initializeEventTracking
5
- } from "../chunk-DY7EQ7D2.mjs";
5
+ } from "../chunk-RRMMXWST.mjs";
6
6
  import {
7
7
  eventPublisher,
8
8
  eventSubscriber,
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  DEFAULT_CURRENCY,
13
13
  EventNames
14
- } from "../chunk-OT32PIVB.mjs";
14
+ } from "../chunk-CGM7UE4D.mjs";
15
15
  import "../chunk-C6F4QLQO.mjs";
16
16
  import "../chunk-4RDPDMGW.mjs";
17
17
  import {
package/dist/index.js CHANGED
@@ -737,8 +737,15 @@ var PixelAdapter = class extends BaseAdapter {
737
737
  if (!pixelId) {
738
738
  this.logger.warn("Pixel ID not provided. Skipping fbq init.");
739
739
  } else {
740
- window.fbq("init", pixelId);
741
- this.logger.info("Successfully initialized", { pixelId: "***" });
740
+ const isAlreadyInitialized = window._fbq?.loaded || window.fbq?.loaded || document.querySelector(`script[src*="fbevents.js"]`)?.getAttribute("data-pixel-id") === pixelId;
741
+ if (!isAlreadyInitialized) {
742
+ window.fbq("init", pixelId);
743
+ this.logger.info("Successfully initialized", { pixelId: "***" });
744
+ } else {
745
+ this.logger.info("Pixel already initialized, skipping init", {
746
+ pixelId: "***"
747
+ });
748
+ }
742
749
  }
743
750
  }
744
751
  this.initialized = true;