shopkit-analytics 1.2.1 → 1.2.3

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.
@@ -1,4 +1,4 @@
1
- export { B as BaseAdapter, c as GoogleAdapter, G as GoogleAdapterConfig, d as MoengageAdapter, a as MoengageAdapterConfig, b as MultiPixelAdapter, M as MultiPixelAdapterConfig, e as PostHogAdapter, P as PostHogAdapterConfig, f as ShopifyAdapter, S as ShopifyAdapterConfig } from '../index-fYvOG_to.mjs';
1
+ export { B as BaseAdapter, c as GoogleAdapter, G as GoogleAdapterConfig, d as MoengageAdapter, a as MoengageAdapterConfig, b as MultiPixelAdapter, M as MultiPixelAdapterConfig, e as PostHogAdapter, P as PostHogAdapterConfig, f as ShopifyAdapter, S as ShopifyAdapterConfig } from '../index-BJbaJQAQ.mjs';
2
2
  import '../types.mjs';
3
3
  import '../subscriber-90r_t90W.mjs';
4
4
  import '../types-BBZbvq9-.mjs';
@@ -1,4 +1,4 @@
1
- export { B as BaseAdapter, c as GoogleAdapter, G as GoogleAdapterConfig, d as MoengageAdapter, a as MoengageAdapterConfig, b as MultiPixelAdapter, M as MultiPixelAdapterConfig, e as PostHogAdapter, P as PostHogAdapterConfig, f as ShopifyAdapter, S as ShopifyAdapterConfig } from '../index-B-TnPt4F.js';
1
+ export { B as BaseAdapter, c as GoogleAdapter, G as GoogleAdapterConfig, d as MoengageAdapter, a as MoengageAdapterConfig, b as MultiPixelAdapter, M as MultiPixelAdapterConfig, e as PostHogAdapter, P as PostHogAdapterConfig, f as ShopifyAdapter, S as ShopifyAdapterConfig } from '../index-Dm7lrTiD.js';
2
2
  import '../types.js';
3
3
  import '../subscriber-AtiHiP3i.js';
4
4
  import '../types-BBZbvq9-.js';
@@ -462,10 +462,12 @@ var MultiPixelAdapter = class extends BaseAdapter {
462
462
  if (this.shouldSkipEvent(event.type)) {
463
463
  return;
464
464
  }
465
+ const timestamp = Date.now();
465
466
  const transformEvent = {
466
467
  ...event,
467
468
  eventId: event.eventId || generateEventId(event.type),
468
- timestamp: Date.now()
469
+ timestamp: event.timestamp || timestamp,
470
+ event_source_url: event.event_source_url || !(typeof window === "undefined") ? window.location.href : ""
469
471
  };
470
472
  await this.trackClientSide(transformEvent, adapterParams);
471
473
  if (this.pixels.some((pixel) => pixel.config.enableCAPI)) {
@@ -494,9 +496,12 @@ var MultiPixelAdapter = class extends BaseAdapter {
494
496
  if (!eventName) {
495
497
  return;
496
498
  }
499
+ const browserInfo = getBrowserInfo();
497
500
  try {
498
501
  window.fbq("track", eventName, enhancedParams, {
499
- eventID: event.eventId
502
+ eventID: event.eventId,
503
+ fbc: browserInfo.fbc,
504
+ fbp: browserInfo.fbp
500
505
  });
501
506
  } catch (error) {
502
507
  console.error("Facebook Pixel tracking error:", error);
@@ -546,55 +551,58 @@ var MultiPixelAdapter = class extends BaseAdapter {
546
551
  let baseParams = {};
547
552
  let eventName = "";
548
553
  switch (event.type) {
549
- case "page_view" /* PAGE_VIEW */:
554
+ case "page_view" /* PAGE_VIEW */: {
550
555
  const pageViewEvent = event;
551
556
  eventName = this.getEventName(adapterParams, "PageView");
552
557
  baseParams = {
553
- content_name: pageViewEvent.page_title || pageViewEvent.title,
554
- content_category: pageViewEvent.event_category,
555
- page_location: pageViewEvent.page_location || pageViewEvent.path,
556
- page_title: pageViewEvent.page_title || pageViewEvent.title,
557
- page_referrer: pageViewEvent.page_referrer || pageViewEvent.referrer,
558
- page_path: pageViewEvent.page_path || pageViewEvent.path
558
+ event_source_url: pageViewEvent.event_source_url
559
559
  };
560
560
  break;
561
- case "view_content" /* VIEW_CONTENT */:
561
+ }
562
+ case "view_content" /* VIEW_CONTENT */: {
562
563
  const viewContentEvent = event;
563
564
  eventName = this.getEventName(adapterParams, "ViewContent");
564
565
  baseParams = {
566
+ event_source_url: viewContentEvent.event_source_url,
565
567
  content_type: viewContentEvent.content_type || "product",
566
568
  content_ids: viewContentEvent.content_ids || [],
567
- content_name: viewContentEvent.content_name || "",
568
- content_category: viewContentEvent.content_category || "",
569
+ content_name: viewContentEvent.content_name,
570
+ content_category: viewContentEvent.content_category || "product",
569
571
  value: viewContentEvent.value || 0,
570
572
  currency: viewContentEvent.currency || "INR"
571
573
  };
572
574
  break;
573
- case "add_to_cart" /* ADD_TO_CART */:
575
+ }
576
+ case "add_to_cart" /* ADD_TO_CART */: {
574
577
  const cartEvent = event;
575
578
  eventName = this.getEventName(adapterParams, "AddToCart");
576
579
  baseParams = {
577
- content_type: "product_group",
580
+ event_source_url: cartEvent.event_source_url,
581
+ content_type: cartEvent.content_type || "product",
578
582
  content_ids: [cartEvent.productId],
579
583
  content_name: cartEvent.productName,
580
584
  value: cartEvent.price,
581
585
  currency: cartEvent.currency || "INR"
582
586
  };
583
587
  break;
584
- case "search" /* SEARCH */:
588
+ }
589
+ case "search" /* SEARCH */: {
585
590
  const searchEvent = event;
586
591
  eventName = this.getEventName(adapterParams, "Search");
587
592
  baseParams = {
593
+ event_source_url: searchEvent.event_source_url,
588
594
  search_string: searchEvent.searchTerm,
589
595
  content_category: "product",
590
596
  content_ids: searchEvent.content_ids || []
591
597
  };
592
598
  break;
593
- case "initiate_checkout" /* INITIATE_CHECKOUT */:
599
+ }
600
+ case "initiate_checkout" /* INITIATE_CHECKOUT */: {
594
601
  const checkoutEvent = event;
595
602
  eventName = this.getEventName(adapterParams, "InitiateCheckout");
596
603
  baseParams = {
597
- content_type: "product",
604
+ event_source_url: checkoutEvent.event_source_url,
605
+ content_type: checkoutEvent.content_type || "product",
598
606
  currency: checkoutEvent.currency || "INR",
599
607
  value: checkoutEvent.cartValue,
600
608
  num_items: checkoutEvent.itemCount || checkoutEvent.items?.length || 0,
@@ -605,25 +613,27 @@ var MultiPixelAdapter = class extends BaseAdapter {
605
613
  })) || []
606
614
  };
607
615
  break;
608
- case "purchase" /* PURCHASE */:
616
+ }
617
+ case "purchase" /* PURCHASE */: {
609
618
  const purchaseEvent = event;
610
619
  eventName = this.getEventName(adapterParams, "Purchase");
611
620
  baseParams = {
621
+ event_source_url: purchaseEvent.event_source_url,
612
622
  content_type: purchaseEvent.content_type || "product",
613
- content_ids: purchaseEvent.content_ids || [],
623
+ contents: purchaseEvent.contents || [],
614
624
  currency: purchaseEvent.currency || "INR",
615
- value: purchaseEvent.value,
616
625
  num_items: purchaseEvent.num_items || purchaseEvent.contents?.length || 0,
617
- contents: purchaseEvent.contents || []
626
+ value: purchaseEvent.value,
627
+ order_id: purchaseEvent.order_id
618
628
  };
619
629
  break;
620
- default:
630
+ }
631
+ default: {
621
632
  this.logger.warn(`Skipping unknown event type: ${event.type}`);
622
633
  return { eventName: "", enhancedParams: {} };
634
+ }
623
635
  }
624
- const affiliateParams = this.enhanceWithAffiliateParams(baseParams);
625
- const experimentParams = this.enhanceWithExperimentParams(affiliateParams);
626
- const enhancedParams = this.mergeEventData(experimentParams, adapterParams);
636
+ const enhancedParams = this.mergeEventData(baseParams, adapterParams);
627
637
  return { eventName, enhancedParams };
628
638
  }
629
639
  /**