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.
@@ -423,8 +423,15 @@ var PixelAdapter = class extends BaseAdapter {
423
423
  if (!pixelId) {
424
424
  this.logger.warn("Pixel ID not provided. Skipping fbq init.");
425
425
  } else {
426
- window.fbq("init", pixelId);
427
- this.logger.info("Successfully initialized", { pixelId: "***" });
426
+ const isAlreadyInitialized = window._fbq?.loaded || window.fbq?.loaded || document.querySelector(`script[src*="fbevents.js"]`)?.getAttribute("data-pixel-id") === pixelId;
427
+ if (!isAlreadyInitialized) {
428
+ window.fbq("init", pixelId);
429
+ this.logger.info("Successfully initialized", { pixelId: "***" });
430
+ } else {
431
+ this.logger.info("Pixel already initialized, skipping init", {
432
+ pixelId: "***"
433
+ });
434
+ }
428
435
  }
429
436
  }
430
437
  this.initialized = true;