medusa-storefront-analytics 1.2.0
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/README.md +57 -0
- package/dist/core/compose.d.ts +6 -0
- package/dist/core/noop-adapter.d.ts +3 -0
- package/dist/core/types.d.ts +31 -0
- package/dist/ecommerce/ga4-ecommerce.d.ts +65 -0
- package/dist/events/forms.d.ts +11 -0
- package/dist/events/meta-events.d.ts +27 -0
- package/dist/events/reviews.d.ts +8 -0
- package/dist/index.d.ts +10 -0
- package/dist/providers/gtm.d.ts +23 -0
- package/dist/providers/meta-pixel-guard.d.ts +9 -0
- package/dist/providers/meta-pixel.d.ts +9 -0
- package/dist/ui-library.js +420 -0
- package/dist/ui-library.umd.cjs +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# medusa-storefront-analytics
|
|
2
|
+
|
|
3
|
+
Layered analytics for Medusa storefronts. **Core** defines adapters; **providers** implement GTM; **events** expose domain helpers.
|
|
4
|
+
|
|
5
|
+
## Layers
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
events/reviews.ts → emitReviewSubmitted(adapter, { productId, productName, rating })
|
|
9
|
+
events/forms.ts → emitContactFormSubmitted, emitLeadCaptured
|
|
10
|
+
providers/gtm.ts → createGtmAnalyticsAdapter() → dataLayer pushes
|
|
11
|
+
core/types.ts → StorefrontAnalyticsAdapter interface
|
|
12
|
+
core/compose.ts → composeAnalyticsAdapters([gtm, custom])
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Review submitted event
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createGtmAnalyticsAdapter, emitReviewSubmitted } from "medusa-storefront-analytics";
|
|
19
|
+
|
|
20
|
+
const analytics = createGtmAnalyticsAdapter();
|
|
21
|
+
|
|
22
|
+
emitReviewSubmitted(analytics, {
|
|
23
|
+
productId: "prod_123",
|
|
24
|
+
productName: "Kids Hoodie",
|
|
25
|
+
rating: 5,
|
|
26
|
+
reviewTitle: "Great fit",
|
|
27
|
+
isUpdate: false,
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**dataLayer pushes:**
|
|
32
|
+
|
|
33
|
+
- `event: "review_submitted"` with `product_id`, `product_name`, `rating`, `review_title`
|
|
34
|
+
- `event: "form_submit"` (legacy) with `form_type: "product_review_submit"` for existing GTM tags
|
|
35
|
+
|
|
36
|
+
## Storefront wiring
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// lib/adapters/analytics.ts
|
|
40
|
+
import { createGtmAnalyticsAdapter } from "medusa-storefront-analytics";
|
|
41
|
+
export const storefrontAnalytics = createGtmAnalyticsAdapter();
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<SubmitReviewModal analytics={storefrontAnalytics} ... />
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Compose multiple backends
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { composeAnalyticsAdapters, createGtmAnalyticsAdapter } from "medusa-storefront-analytics";
|
|
52
|
+
|
|
53
|
+
export const storefrontAnalytics = composeAnalyticsAdapters([
|
|
54
|
+
createGtmAnalyticsAdapter(),
|
|
55
|
+
{ trackReviewSubmitted(p) { console.log("review", p); } },
|
|
56
|
+
]);
|
|
57
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Shared product reference for ecommerce / UGC events */
|
|
2
|
+
export interface ProductRef {
|
|
3
|
+
productId: string;
|
|
4
|
+
productName: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ReviewSubmittedPayload extends ProductRef {
|
|
7
|
+
rating: number;
|
|
8
|
+
/** Review title entered by the customer */
|
|
9
|
+
reviewTitle?: string;
|
|
10
|
+
/** True when an existing review was updated */
|
|
11
|
+
isUpdate: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface FormSubmittedPayload {
|
|
14
|
+
form_type: string;
|
|
15
|
+
formType?: string;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Port implemented by each site (GTM, Meta, custom). Domain helpers call these methods.
|
|
20
|
+
*/
|
|
21
|
+
export interface StorefrontAnalyticsAdapter {
|
|
22
|
+
trackReviewSubmitted(payload: ReviewSubmittedPayload): void;
|
|
23
|
+
trackReviewUpdated?(payload: ReviewSubmittedPayload): void;
|
|
24
|
+
trackFormSubmitted?(payload: FormSubmittedPayload): void;
|
|
25
|
+
trackEvent?(eventName: string, data?: Record<string, unknown>): void;
|
|
26
|
+
}
|
|
27
|
+
export type AnalyticsEventMap = {
|
|
28
|
+
review_submitted: ReviewSubmittedPayload;
|
|
29
|
+
review_updated: ReviewSubmittedPayload;
|
|
30
|
+
form_submit: FormSubmittedPayload;
|
|
31
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { META_STANDARD_EVENTS, EcommercePayload, GA4Item, MetaStandardEventName } from '../events/meta-events';
|
|
2
|
+
|
|
3
|
+
export { META_STANDARD_EVENTS, type EcommercePayload, type GA4Item, type MetaStandardEventName, };
|
|
4
|
+
type CartLineLike = {
|
|
5
|
+
id: string;
|
|
6
|
+
variant_id?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
product_title?: string;
|
|
9
|
+
quantity: number;
|
|
10
|
+
total?: number;
|
|
11
|
+
};
|
|
12
|
+
type CartLike = {
|
|
13
|
+
items?: CartLineLike[];
|
|
14
|
+
total?: number;
|
|
15
|
+
currency_code?: string;
|
|
16
|
+
region?: {
|
|
17
|
+
currency_code?: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare function trackMetaStandardEvent(metaEvent: MetaStandardEventName, params?: Record<string, unknown>): void;
|
|
21
|
+
export declare function cartToEcommercePayload(cart: CartLike | null): EcommercePayload | null;
|
|
22
|
+
export declare function trackAddToCart(payload: EcommercePayload): void;
|
|
23
|
+
export declare function trackRemoveFromCart(payload: EcommercePayload): void;
|
|
24
|
+
export declare function trackViewCart(payload: EcommercePayload): void;
|
|
25
|
+
export declare function trackViewItem(payload: EcommercePayload): void;
|
|
26
|
+
export declare function trackViewItemList(payload: {
|
|
27
|
+
list_id?: string;
|
|
28
|
+
list_name?: string;
|
|
29
|
+
items: GA4Item[];
|
|
30
|
+
}): void;
|
|
31
|
+
export declare function markInitiateCheckoutFired(cartId: string): void;
|
|
32
|
+
export declare function wasInitiateCheckoutFired(cartId: string, maxAgeMs?: number): boolean;
|
|
33
|
+
export declare function trackInitiateCheckoutFromCart(payload: EcommercePayload, cartId?: string): void;
|
|
34
|
+
export declare function trackBeginCheckout(payload: EcommercePayload): void;
|
|
35
|
+
export declare function trackAddShippingInfo(payload: EcommercePayload): void;
|
|
36
|
+
export declare function trackAddPaymentInfo(payload: EcommercePayload, extra?: Record<string, unknown>): void;
|
|
37
|
+
export declare function trackPurchase(payload: {
|
|
38
|
+
transaction_id: string;
|
|
39
|
+
currency: string;
|
|
40
|
+
value: number;
|
|
41
|
+
tax?: number;
|
|
42
|
+
shipping?: number;
|
|
43
|
+
items: GA4Item[];
|
|
44
|
+
}): void;
|
|
45
|
+
export declare function trackAddToWishlist(params: {
|
|
46
|
+
content_ids: string[];
|
|
47
|
+
currency?: string;
|
|
48
|
+
value?: number;
|
|
49
|
+
}): void;
|
|
50
|
+
export declare function trackCompleteRegistration(params?: {
|
|
51
|
+
status?: string;
|
|
52
|
+
method?: string;
|
|
53
|
+
}): void;
|
|
54
|
+
export declare function trackContact(params?: {
|
|
55
|
+
form_type?: string;
|
|
56
|
+
}): void;
|
|
57
|
+
export declare function trackLead(params?: {
|
|
58
|
+
form_type?: string;
|
|
59
|
+
}): void;
|
|
60
|
+
export declare function trackSearch(searchString: string): void;
|
|
61
|
+
export declare function trackHeroCtaClick(params: {
|
|
62
|
+
label?: string;
|
|
63
|
+
link?: string;
|
|
64
|
+
}): void;
|
|
65
|
+
export declare function trackCartNavClick(cart: CartLike | null): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FormSubmittedPayload, StorefrontAnalyticsAdapter } from '../core/types';
|
|
2
|
+
|
|
3
|
+
export declare function emitFormSubmitted(analytics: StorefrontAnalyticsAdapter | undefined, payload: FormSubmittedPayload): void;
|
|
4
|
+
export declare function emitContactFormSubmitted(analytics: StorefrontAnalyticsAdapter | undefined, params?: {
|
|
5
|
+
formType?: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}): void;
|
|
8
|
+
export declare function emitLeadCaptured(analytics: StorefrontAnalyticsAdapter | undefined, params?: {
|
|
9
|
+
formType?: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Meta Pixel standard event names (fbq second argument) */
|
|
2
|
+
export declare const META_STANDARD_EVENTS: {
|
|
3
|
+
readonly AddPaymentInfo: "AddPaymentInfo";
|
|
4
|
+
readonly AddToCart: "AddToCart";
|
|
5
|
+
readonly AddToWishlist: "AddToWishlist";
|
|
6
|
+
readonly CompleteRegistration: "CompleteRegistration";
|
|
7
|
+
readonly Contact: "Contact";
|
|
8
|
+
readonly InitiateCheckout: "InitiateCheckout";
|
|
9
|
+
readonly Lead: "Lead";
|
|
10
|
+
readonly Purchase: "Purchase";
|
|
11
|
+
readonly Search: "Search";
|
|
12
|
+
readonly ViewContent: "ViewContent";
|
|
13
|
+
};
|
|
14
|
+
export type MetaStandardEventName = (typeof META_STANDARD_EVENTS)[keyof typeof META_STANDARD_EVENTS];
|
|
15
|
+
export type GA4Item = {
|
|
16
|
+
item_id: string;
|
|
17
|
+
item_name: string;
|
|
18
|
+
price?: number;
|
|
19
|
+
quantity?: number;
|
|
20
|
+
index?: number;
|
|
21
|
+
item_variant?: string;
|
|
22
|
+
};
|
|
23
|
+
export type EcommercePayload = {
|
|
24
|
+
currency: string;
|
|
25
|
+
value: number;
|
|
26
|
+
items: GA4Item[];
|
|
27
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReviewSubmittedPayload, StorefrontAnalyticsAdapter } from '../core/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Domain helper: call after a review is successfully saved.
|
|
5
|
+
*/
|
|
6
|
+
export declare function emitReviewSubmitted(analytics: StorefrontAnalyticsAdapter | undefined, payload: Omit<ReviewSubmittedPayload, "isUpdate"> & {
|
|
7
|
+
isUpdate?: boolean;
|
|
8
|
+
}): void;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { AnalyticsEventMap, FormSubmittedPayload, ProductRef, ReviewSubmittedPayload, StorefrontAnalyticsAdapter, } from './core/types';
|
|
2
|
+
export { noopAnalyticsAdapter } from './core/noop-adapter';
|
|
3
|
+
export { composeAnalyticsAdapters } from './core/compose';
|
|
4
|
+
export { createGtmAnalyticsAdapter, defaultStorefrontAnalytics, pushToDataLayer, trackGtmEvent, trackEvent, initGTM, type GtmAnalyticsAdapterOptions, } from './providers/gtm';
|
|
5
|
+
export { emitReviewSubmitted } from './events/reviews';
|
|
6
|
+
export { emitContactFormSubmitted, emitFormSubmitted, emitLeadCaptured, } from './events/forms';
|
|
7
|
+
export { META_STANDARD_EVENTS, type EcommercePayload, type GA4Item, type MetaStandardEventName, } from './events/meta-events';
|
|
8
|
+
export { META_PIXEL_DATALAYER_EVENT, fireMetaPixelEvent, fireMetaEcommerceEvent, fireMetaPurchase, } from './providers/meta-pixel';
|
|
9
|
+
export { META_EXPLICIT_KEY, disableMetaPixelAutoConfig, installMetaPixelGuard, } from './providers/meta-pixel-guard';
|
|
10
|
+
export { cartToEcommercePayload, markInitiateCheckoutFired, trackAddPaymentInfo, trackAddShippingInfo, trackAddToCart, trackAddToWishlist, trackBeginCheckout, trackCartNavClick, trackCompleteRegistration, trackContact, trackHeroCtaClick, trackInitiateCheckoutFromCart, trackLead, trackMetaStandardEvent, trackPurchase, trackRemoveFromCart, trackSearch, trackViewCart, trackViewItem, trackViewItemList, wasInitiateCheckoutFired, } from './ecommerce/ga4-ecommerce';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StorefrontAnalyticsAdapter } from '../core/types';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
dataLayer?: Record<string, unknown>[];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare function pushToDataLayer(data: Record<string, unknown>): void;
|
|
9
|
+
export declare function trackGtmEvent(eventName: string, params?: Record<string, unknown>): void;
|
|
10
|
+
export interface GtmAnalyticsAdapterOptions {
|
|
11
|
+
/** Also push legacy `form_submit` events (for existing GTM triggers) */
|
|
12
|
+
legacyFormSubmit?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Default GTM / dataLayer adapter for Medusa storefronts.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createGtmAnalyticsAdapter(options?: GtmAnalyticsAdapterOptions): StorefrontAnalyticsAdapter;
|
|
18
|
+
/** Default GTM adapter (legacy form_submit + review events). */
|
|
19
|
+
export declare const defaultStorefrontAnalytics: StorefrontAnalyticsAdapter;
|
|
20
|
+
/** @deprecated Use createGtmAnalyticsAdapter */
|
|
21
|
+
export declare const initGTM: (id: string) => void;
|
|
22
|
+
/** @deprecated Use trackGtmEvent */
|
|
23
|
+
export declare const trackEvent: typeof trackGtmEvent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blocks Meta automatic mis-classification (e.g. Subscribe on non-newsletter clicks).
|
|
3
|
+
* Only events fired via fireMetaPixelEvent() include __cm_explicit and pass through.
|
|
4
|
+
*/
|
|
5
|
+
export declare const META_EXPLICIT_KEY = "__cm_explicit";
|
|
6
|
+
/** Disable Meta pixel automatic event configuration (button scraping, etc.) */
|
|
7
|
+
export declare function disableMetaPixelAutoConfig(): boolean;
|
|
8
|
+
/** Call once on app load; retries until GTM/pixel has initialized fbq */
|
|
9
|
+
export declare function installMetaPixelGuard(): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { META_STANDARD_EVENTS, EcommercePayload, MetaStandardEventName } from '../events/meta-events';
|
|
2
|
+
|
|
3
|
+
export { META_STANDARD_EVENTS, type MetaStandardEventName, type EcommercePayload };
|
|
4
|
+
export declare const META_PIXEL_DATALAYER_EVENT = "meta_pixel_track";
|
|
5
|
+
export declare function fireMetaPixelEvent(metaEvent: MetaStandardEventName, params?: Record<string, unknown>): void;
|
|
6
|
+
export declare function fireMetaEcommerceEvent(metaEvent: MetaStandardEventName, payload: EcommercePayload, extra?: Record<string, unknown>): void;
|
|
7
|
+
export declare function fireMetaPurchase(payload: EcommercePayload & {
|
|
8
|
+
transaction_id: string;
|
|
9
|
+
}): void;
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
const D = {
|
|
2
|
+
trackReviewSubmitted: () => {
|
|
3
|
+
},
|
|
4
|
+
trackReviewUpdated: () => {
|
|
5
|
+
},
|
|
6
|
+
trackFormSubmitted: () => {
|
|
7
|
+
},
|
|
8
|
+
trackEvent: () => {
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
function V(t) {
|
|
12
|
+
const e = t.filter(Boolean);
|
|
13
|
+
return {
|
|
14
|
+
trackReviewSubmitted(n) {
|
|
15
|
+
e.forEach((i) => i.trackReviewSubmitted(n));
|
|
16
|
+
},
|
|
17
|
+
trackReviewUpdated(n) {
|
|
18
|
+
e.forEach((i) => {
|
|
19
|
+
var r;
|
|
20
|
+
return (r = i.trackReviewUpdated) == null ? void 0 : r.call(i, n);
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
trackFormSubmitted(n) {
|
|
24
|
+
e.forEach((i) => {
|
|
25
|
+
var r;
|
|
26
|
+
return (r = i.trackFormSubmitted) == null ? void 0 : r.call(i, n);
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
trackEvent(n, i) {
|
|
30
|
+
e.forEach((r) => {
|
|
31
|
+
var u;
|
|
32
|
+
return (u = r.trackEvent) == null ? void 0 : u.call(r, n, i);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function p(t) {
|
|
38
|
+
typeof window > "u" || (window.dataLayer = window.dataLayer || [], window.dataLayer.push(t));
|
|
39
|
+
}
|
|
40
|
+
function f(t, e) {
|
|
41
|
+
p({
|
|
42
|
+
event: t,
|
|
43
|
+
...e
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function C(t = {}) {
|
|
47
|
+
const { legacyFormSubmit: e = !0 } = t, n = (i, r) => {
|
|
48
|
+
f(r, {
|
|
49
|
+
product_id: i.productId,
|
|
50
|
+
product_name: i.productName,
|
|
51
|
+
rating: i.rating,
|
|
52
|
+
review_title: i.reviewTitle,
|
|
53
|
+
is_update: i.isUpdate
|
|
54
|
+
}), e && f("form_submit", {
|
|
55
|
+
form_type: r === "review_updated" ? "product_review_update" : "product_review_submit",
|
|
56
|
+
product_id: i.productId,
|
|
57
|
+
product_name: i.productName,
|
|
58
|
+
rating: i.rating
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
trackReviewSubmitted(i) {
|
|
63
|
+
n({ ...i, isUpdate: !1 }, "review_submitted");
|
|
64
|
+
},
|
|
65
|
+
trackReviewUpdated(i) {
|
|
66
|
+
n({ ...i, isUpdate: !0 }, "review_updated");
|
|
67
|
+
},
|
|
68
|
+
trackFormSubmitted(i) {
|
|
69
|
+
f("form_submit", i);
|
|
70
|
+
},
|
|
71
|
+
trackEvent: f
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const $ = C({
|
|
75
|
+
legacyFormSubmit: !0
|
|
76
|
+
}), j = (t) => {
|
|
77
|
+
if (typeof window > "u") return;
|
|
78
|
+
p({
|
|
79
|
+
"gtm.start": (/* @__PURE__ */ new Date()).getTime(),
|
|
80
|
+
event: "gtm.js"
|
|
81
|
+
});
|
|
82
|
+
const e = document.getElementsByTagName("script")[0], n = document.createElement("script");
|
|
83
|
+
n.async = !0, n.src = `https://www.googletagmanager.com/gtm.js?id=${t}`, e != null && e.parentNode && e.parentNode.insertBefore(n, e);
|
|
84
|
+
}, B = f;
|
|
85
|
+
function G(t, e) {
|
|
86
|
+
if (!t) return;
|
|
87
|
+
const n = {
|
|
88
|
+
productId: e.productId,
|
|
89
|
+
productName: e.productName,
|
|
90
|
+
rating: e.rating,
|
|
91
|
+
reviewTitle: e.reviewTitle,
|
|
92
|
+
isUpdate: e.isUpdate ?? !1
|
|
93
|
+
};
|
|
94
|
+
n.isUpdate && t.trackReviewUpdated ? t.trackReviewUpdated(n) : t.trackReviewSubmitted(n);
|
|
95
|
+
}
|
|
96
|
+
function k(t, e) {
|
|
97
|
+
var n, i;
|
|
98
|
+
(n = t == null ? void 0 : t.trackFormSubmitted) == null || n.call(t, e), (i = t == null ? void 0 : t.trackEvent) == null || i.call(t, "form_submit", e);
|
|
99
|
+
}
|
|
100
|
+
function W(t, e) {
|
|
101
|
+
k(t, {
|
|
102
|
+
form_type: (e == null ? void 0 : e.formType) ?? "contact_us_form",
|
|
103
|
+
...e
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function K(t, e) {
|
|
107
|
+
var n;
|
|
108
|
+
t && ((n = t.trackEvent) == null || n.call(t, "Lead", {
|
|
109
|
+
form_type: (e == null ? void 0 : e.formType) ?? "newsletter_signup",
|
|
110
|
+
...e
|
|
111
|
+
}), k(t, {
|
|
112
|
+
form_type: (e == null ? void 0 : e.formType) ?? "lead",
|
|
113
|
+
...e
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
const o = {
|
|
117
|
+
AddPaymentInfo: "AddPaymentInfo",
|
|
118
|
+
AddToCart: "AddToCart",
|
|
119
|
+
AddToWishlist: "AddToWishlist",
|
|
120
|
+
CompleteRegistration: "CompleteRegistration",
|
|
121
|
+
Contact: "Contact",
|
|
122
|
+
InitiateCheckout: "InitiateCheckout",
|
|
123
|
+
Lead: "Lead",
|
|
124
|
+
Purchase: "Purchase",
|
|
125
|
+
Search: "Search",
|
|
126
|
+
ViewContent: "ViewContent"
|
|
127
|
+
}, s = "__cm_explicit";
|
|
128
|
+
function E() {
|
|
129
|
+
if (typeof window > "u") return !1;
|
|
130
|
+
const t = window.fbq;
|
|
131
|
+
if (typeof t != "function") return !1;
|
|
132
|
+
try {
|
|
133
|
+
t("set", "autoConfig", !1);
|
|
134
|
+
} catch {
|
|
135
|
+
}
|
|
136
|
+
return !0;
|
|
137
|
+
}
|
|
138
|
+
function T(t, e) {
|
|
139
|
+
if (typeof t != "string") return !1;
|
|
140
|
+
if (t === "Subscribe") {
|
|
141
|
+
const n = e;
|
|
142
|
+
return !(n != null && n[s]);
|
|
143
|
+
}
|
|
144
|
+
return !1;
|
|
145
|
+
}
|
|
146
|
+
function A() {
|
|
147
|
+
if (typeof window > "u") return !1;
|
|
148
|
+
const t = window, e = t.fbq;
|
|
149
|
+
if (typeof e != "function" || t.__cmFbqPatched) return !0;
|
|
150
|
+
const n = e, i = function(...r) {
|
|
151
|
+
if (!(r[0] === "track" && T(r[1], r[2])))
|
|
152
|
+
return n.apply(this, r);
|
|
153
|
+
};
|
|
154
|
+
return Object.assign(i, n), t.fbq = i, t._fbq && (t._fbq = i), t.__cmFbqPatched = !0, !0;
|
|
155
|
+
}
|
|
156
|
+
function w() {
|
|
157
|
+
if (typeof window > "u") return !1;
|
|
158
|
+
const t = window;
|
|
159
|
+
if (!t.dataLayer || t.__cmDataLayerPatched) return !0;
|
|
160
|
+
const e = t.dataLayer.push.bind(t.dataLayer);
|
|
161
|
+
return t.dataLayer.push = function(...n) {
|
|
162
|
+
const i = n.filter((r) => {
|
|
163
|
+
if (!r || typeof r != "object") return !0;
|
|
164
|
+
const u = r;
|
|
165
|
+
return !(u.meta_event === "Subscribe" && !u[s] || u.event === "subscribe" && !u[s]);
|
|
166
|
+
});
|
|
167
|
+
return e(...i);
|
|
168
|
+
}, t.__cmDataLayerPatched = !0, !0;
|
|
169
|
+
}
|
|
170
|
+
function O() {
|
|
171
|
+
if (typeof window > "u") return;
|
|
172
|
+
w();
|
|
173
|
+
let t = 0;
|
|
174
|
+
const e = 60, n = () => {
|
|
175
|
+
w();
|
|
176
|
+
const i = A();
|
|
177
|
+
i && E(), !i && ++t < e && setTimeout(n, 250);
|
|
178
|
+
};
|
|
179
|
+
n();
|
|
180
|
+
}
|
|
181
|
+
const S = "meta_pixel_track";
|
|
182
|
+
function I(t) {
|
|
183
|
+
return (t ?? "INR").toUpperCase();
|
|
184
|
+
}
|
|
185
|
+
function L(t) {
|
|
186
|
+
const e = t.items ?? [], n = e.reduce((i, r) => i + (r.quantity ?? 1), 0);
|
|
187
|
+
return {
|
|
188
|
+
currency: I(t.currency),
|
|
189
|
+
value: t.value,
|
|
190
|
+
content_ids: e.map((i) => String(i.item_id)),
|
|
191
|
+
content_type: "product",
|
|
192
|
+
contents: e.map((i) => ({
|
|
193
|
+
id: String(i.item_id),
|
|
194
|
+
quantity: i.quantity ?? 1,
|
|
195
|
+
item_price: i.price ?? 0
|
|
196
|
+
})),
|
|
197
|
+
num_items: n
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function R(t, e) {
|
|
201
|
+
if (typeof window > "u") return;
|
|
202
|
+
const n = window;
|
|
203
|
+
n.dataLayer = n.dataLayer || [], n.dataLayer.push({
|
|
204
|
+
event: S,
|
|
205
|
+
meta_event: t,
|
|
206
|
+
[s]: !0,
|
|
207
|
+
...e
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function h(t, e = {}) {
|
|
211
|
+
if (R(t, e), typeof window > "u") return;
|
|
212
|
+
const n = window.fbq;
|
|
213
|
+
typeof n == "function" && n("track", t, { ...e, [s]: !0 });
|
|
214
|
+
}
|
|
215
|
+
function _(t, e, n) {
|
|
216
|
+
h(t, { ...L(e), ...n });
|
|
217
|
+
}
|
|
218
|
+
function q(t) {
|
|
219
|
+
const { transaction_id: e, ...n } = t;
|
|
220
|
+
_(o.Purchase, n, {
|
|
221
|
+
order_id: e
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
const P = {
|
|
225
|
+
add_to_cart: o.AddToCart,
|
|
226
|
+
view_item: o.ViewContent,
|
|
227
|
+
view_cart: o.ViewContent,
|
|
228
|
+
begin_checkout: o.InitiateCheckout,
|
|
229
|
+
add_payment_info: o.AddPaymentInfo,
|
|
230
|
+
purchase: o.Purchase
|
|
231
|
+
};
|
|
232
|
+
function v(t) {
|
|
233
|
+
if (typeof window > "u") return;
|
|
234
|
+
const e = window;
|
|
235
|
+
e.dataLayer = e.dataLayer || [], e.dataLayer.push({ ecommerce: null }), e.dataLayer.push(t);
|
|
236
|
+
}
|
|
237
|
+
function m(t) {
|
|
238
|
+
return (t ?? "INR").toUpperCase();
|
|
239
|
+
}
|
|
240
|
+
function b(t) {
|
|
241
|
+
const e = t.items ?? [], n = e.reduce((i, r) => i + (r.quantity ?? 1), 0);
|
|
242
|
+
return {
|
|
243
|
+
currency: m(t.currency),
|
|
244
|
+
value: t.value,
|
|
245
|
+
content_ids: e.map((i) => String(i.item_id)),
|
|
246
|
+
content_type: "product",
|
|
247
|
+
contents: e.map((i) => ({
|
|
248
|
+
id: String(i.item_id),
|
|
249
|
+
quantity: i.quantity ?? 1,
|
|
250
|
+
item_price: i.price ?? 0
|
|
251
|
+
})),
|
|
252
|
+
num_items: n
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function d(t, e, n) {
|
|
256
|
+
const i = m(e.currency), r = { ...e, currency: i }, u = b({ ...e, currency: i });
|
|
257
|
+
v({
|
|
258
|
+
event: t,
|
|
259
|
+
ecommerce: r,
|
|
260
|
+
...u,
|
|
261
|
+
...n
|
|
262
|
+
});
|
|
263
|
+
const c = P[t];
|
|
264
|
+
c && (t === "purchase" && (n != null && n.transaction_id) ? q({
|
|
265
|
+
...e,
|
|
266
|
+
currency: i,
|
|
267
|
+
transaction_id: String(n.transaction_id)
|
|
268
|
+
}) : _(c, { ...e, currency: i }, n));
|
|
269
|
+
}
|
|
270
|
+
function a(t, e) {
|
|
271
|
+
h(t, e ?? {});
|
|
272
|
+
}
|
|
273
|
+
function F(t) {
|
|
274
|
+
var r, u;
|
|
275
|
+
if (!((r = t == null ? void 0 : t.items) != null && r.length)) return null;
|
|
276
|
+
const e = m(t.currency_code ?? ((u = t.region) == null ? void 0 : u.currency_code)), n = (t.total ?? 0) / 100, i = t.items.map((c, y) => {
|
|
277
|
+
const g = c.total && c.quantity ? c.total / c.quantity : 0;
|
|
278
|
+
return {
|
|
279
|
+
item_id: c.variant_id ?? c.id,
|
|
280
|
+
item_name: c.title ?? c.product_title ?? "",
|
|
281
|
+
price: g / 100,
|
|
282
|
+
quantity: c.quantity,
|
|
283
|
+
index: y
|
|
284
|
+
};
|
|
285
|
+
});
|
|
286
|
+
return { currency: e, value: n, items: i };
|
|
287
|
+
}
|
|
288
|
+
function X(t) {
|
|
289
|
+
d("add_to_cart", t);
|
|
290
|
+
}
|
|
291
|
+
function Y(t) {
|
|
292
|
+
d("remove_from_cart", t);
|
|
293
|
+
}
|
|
294
|
+
function N(t) {
|
|
295
|
+
d("view_cart", t);
|
|
296
|
+
}
|
|
297
|
+
function z(t) {
|
|
298
|
+
d("view_item", t);
|
|
299
|
+
}
|
|
300
|
+
function H(t) {
|
|
301
|
+
const e = b({
|
|
302
|
+
currency: "INR",
|
|
303
|
+
value: 0,
|
|
304
|
+
items: t.items
|
|
305
|
+
});
|
|
306
|
+
v({
|
|
307
|
+
event: "view_item_list",
|
|
308
|
+
ecommerce: t,
|
|
309
|
+
...e
|
|
310
|
+
}), _(o.ViewContent, {
|
|
311
|
+
currency: "INR",
|
|
312
|
+
value: 0,
|
|
313
|
+
items: t.items
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
const l = "meta_initiate_checkout_";
|
|
317
|
+
function M(t) {
|
|
318
|
+
typeof window > "u" || sessionStorage.setItem(`${l}${t}`, String(Date.now()));
|
|
319
|
+
}
|
|
320
|
+
function x(t, e = 6e4) {
|
|
321
|
+
if (typeof window > "u") return !1;
|
|
322
|
+
const n = sessionStorage.getItem(`${l}${t}`);
|
|
323
|
+
return n ? Date.now() - Number(n) < e : !1;
|
|
324
|
+
}
|
|
325
|
+
function J(t, e) {
|
|
326
|
+
U(t), e && M(e);
|
|
327
|
+
}
|
|
328
|
+
function U(t) {
|
|
329
|
+
d("begin_checkout", t);
|
|
330
|
+
}
|
|
331
|
+
function Q(t) {
|
|
332
|
+
d("add_shipping_info", t);
|
|
333
|
+
}
|
|
334
|
+
function Z(t, e) {
|
|
335
|
+
d("add_payment_info", t, e);
|
|
336
|
+
}
|
|
337
|
+
function tt(t) {
|
|
338
|
+
const { transaction_id: e, ...n } = t;
|
|
339
|
+
d("purchase", n, {
|
|
340
|
+
transaction_id: e,
|
|
341
|
+
order_id: e
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function et(t) {
|
|
345
|
+
a(o.AddToWishlist, {
|
|
346
|
+
content_ids: t.content_ids,
|
|
347
|
+
content_type: "product",
|
|
348
|
+
currency: m(t.currency),
|
|
349
|
+
value: t.value ?? 0
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
function nt(t) {
|
|
353
|
+
a(o.CompleteRegistration, t);
|
|
354
|
+
}
|
|
355
|
+
function it(t) {
|
|
356
|
+
a(o.Contact, t);
|
|
357
|
+
}
|
|
358
|
+
function rt(t) {
|
|
359
|
+
a(o.Lead, t);
|
|
360
|
+
}
|
|
361
|
+
function ot(t) {
|
|
362
|
+
a(o.Search, {
|
|
363
|
+
search_string: t
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
function ct(t) {
|
|
367
|
+
a(o.ViewContent, {
|
|
368
|
+
content_type: "cta",
|
|
369
|
+
content_name: t.label || "shop_now",
|
|
370
|
+
content_category: "hero_banner",
|
|
371
|
+
...t.link ? { content_url: t.link } : {}
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
function ut(t) {
|
|
375
|
+
const e = F(t);
|
|
376
|
+
e && N(e);
|
|
377
|
+
}
|
|
378
|
+
export {
|
|
379
|
+
s as META_EXPLICIT_KEY,
|
|
380
|
+
S as META_PIXEL_DATALAYER_EVENT,
|
|
381
|
+
o as META_STANDARD_EVENTS,
|
|
382
|
+
F as cartToEcommercePayload,
|
|
383
|
+
V as composeAnalyticsAdapters,
|
|
384
|
+
C as createGtmAnalyticsAdapter,
|
|
385
|
+
$ as defaultStorefrontAnalytics,
|
|
386
|
+
E as disableMetaPixelAutoConfig,
|
|
387
|
+
W as emitContactFormSubmitted,
|
|
388
|
+
k as emitFormSubmitted,
|
|
389
|
+
K as emitLeadCaptured,
|
|
390
|
+
G as emitReviewSubmitted,
|
|
391
|
+
_ as fireMetaEcommerceEvent,
|
|
392
|
+
h as fireMetaPixelEvent,
|
|
393
|
+
q as fireMetaPurchase,
|
|
394
|
+
j as initGTM,
|
|
395
|
+
O as installMetaPixelGuard,
|
|
396
|
+
M as markInitiateCheckoutFired,
|
|
397
|
+
D as noopAnalyticsAdapter,
|
|
398
|
+
p as pushToDataLayer,
|
|
399
|
+
Z as trackAddPaymentInfo,
|
|
400
|
+
Q as trackAddShippingInfo,
|
|
401
|
+
X as trackAddToCart,
|
|
402
|
+
et as trackAddToWishlist,
|
|
403
|
+
U as trackBeginCheckout,
|
|
404
|
+
ut as trackCartNavClick,
|
|
405
|
+
nt as trackCompleteRegistration,
|
|
406
|
+
it as trackContact,
|
|
407
|
+
B as trackEvent,
|
|
408
|
+
f as trackGtmEvent,
|
|
409
|
+
ct as trackHeroCtaClick,
|
|
410
|
+
J as trackInitiateCheckoutFromCart,
|
|
411
|
+
rt as trackLead,
|
|
412
|
+
a as trackMetaStandardEvent,
|
|
413
|
+
tt as trackPurchase,
|
|
414
|
+
Y as trackRemoveFromCart,
|
|
415
|
+
ot as trackSearch,
|
|
416
|
+
N as trackViewCart,
|
|
417
|
+
z as trackViewItem,
|
|
418
|
+
H as trackViewItemList,
|
|
419
|
+
x as wasInitiateCheckoutFired
|
|
420
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(r,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(r=typeof globalThis<"u"?globalThis:r||self,_(r.MedusaStorefrontAnalytics={}))})(this,function(r){"use strict";const _={trackReviewSubmitted:()=>{},trackReviewUpdated:()=>{},trackFormSubmitted:()=>{},trackEvent:()=>{}};function R(t){const e=t.filter(Boolean);return{trackReviewSubmitted(n){e.forEach(i=>i.trackReviewSubmitted(n))},trackReviewUpdated(n){e.forEach(i=>{var c;return(c=i.trackReviewUpdated)==null?void 0:c.call(i,n)})},trackFormSubmitted(n){e.forEach(i=>{var c;return(c=i.trackFormSubmitted)==null?void 0:c.call(i,n)})},trackEvent(n,i){e.forEach(c=>{var a;return(a=c.trackEvent)==null?void 0:a.call(c,n,i)})}}}function h(t){typeof window>"u"||(window.dataLayer=window.dataLayer||[],window.dataLayer.push(t))}function m(t,e){h({event:t,...e})}function C(t={}){const{legacyFormSubmit:e=!0}=t,n=(i,c)=>{m(c,{product_id:i.productId,product_name:i.productName,rating:i.rating,review_title:i.reviewTitle,is_update:i.isUpdate}),e&&m("form_submit",{form_type:c==="review_updated"?"product_review_update":"product_review_submit",product_id:i.productId,product_name:i.productName,rating:i.rating})};return{trackReviewSubmitted(i){n({...i,isUpdate:!1},"review_submitted")},trackReviewUpdated(i){n({...i,isUpdate:!0},"review_updated")},trackFormSubmitted(i){m("form_submit",i)},trackEvent:m}}const M=C({legacyFormSubmit:!0}),F=t=>{if(typeof window>"u")return;h({"gtm.start":new Date().getTime(),event:"gtm.js"});const e=document.getElementsByTagName("script")[0],n=document.createElement("script");n.async=!0,n.src=`https://www.googletagmanager.com/gtm.js?id=${t}`,e!=null&&e.parentNode&&e.parentNode.insertBefore(n,e)},q=m;function N(t,e){if(!t)return;const n={productId:e.productId,productName:e.productName,rating:e.rating,reviewTitle:e.reviewTitle,isUpdate:e.isUpdate??!1};n.isUpdate&&t.trackReviewUpdated?t.trackReviewUpdated(n):t.trackReviewSubmitted(n)}function l(t,e){var n,i;(n=t==null?void 0:t.trackFormSubmitted)==null||n.call(t,e),(i=t==null?void 0:t.trackEvent)==null||i.call(t,"form_submit",e)}function V(t,e){l(t,{form_type:(e==null?void 0:e.formType)??"contact_us_form",...e})}function D(t,e){var n;t&&((n=t.trackEvent)==null||n.call(t,"Lead",{form_type:(e==null?void 0:e.formType)??"newsletter_signup",...e}),l(t,{form_type:(e==null?void 0:e.formType)??"lead",...e}))}const o={AddPaymentInfo:"AddPaymentInfo",AddToCart:"AddToCart",AddToWishlist:"AddToWishlist",CompleteRegistration:"CompleteRegistration",Contact:"Contact",InitiateCheckout:"InitiateCheckout",Lead:"Lead",Purchase:"Purchase",Search:"Search",ViewContent:"ViewContent"},s="__cm_explicit";function E(){if(typeof window>"u")return!1;const t=window.fbq;if(typeof t!="function")return!1;try{t("set","autoConfig",!1)}catch{}return!0}function U(t,e){if(typeof t!="string")return!1;if(t==="Subscribe"){const n=e;return!(n!=null&&n[s])}return!1}function G(){if(typeof window>"u")return!1;const t=window,e=t.fbq;if(typeof e!="function"||t.__cmFbqPatched)return!0;const n=e,i=function(...c){if(!(c[0]==="track"&&U(c[1],c[2])))return n.apply(this,c)};return Object.assign(i,n),t.fbq=i,t._fbq&&(t._fbq=i),t.__cmFbqPatched=!0,!0}function b(){if(typeof window>"u")return!1;const t=window;if(!t.dataLayer||t.__cmDataLayerPatched)return!0;const e=t.dataLayer.push.bind(t.dataLayer);return t.dataLayer.push=function(...n){const i=n.filter(c=>{if(!c||typeof c!="object")return!0;const a=c;return!(a.meta_event==="Subscribe"&&!a[s]||a.event==="subscribe"&&!a[s])});return e(...i)},t.__cmDataLayerPatched=!0,!0}function j(){if(typeof window>"u")return;b();let t=0;const e=60,n=()=>{b();const i=G();i&&E(),!i&&++t<e&&setTimeout(n,250)};n()}const y="meta_pixel_track";function $(t){return(t??"INR").toUpperCase()}function B(t){const e=t.items??[],n=e.reduce((i,c)=>i+(c.quantity??1),0);return{currency:$(t.currency),value:t.value,content_ids:e.map(i=>String(i.item_id)),content_type:"product",contents:e.map(i=>({id:String(i.item_id),quantity:i.quantity??1,item_price:i.price??0})),num_items:n}}function W(t,e){if(typeof window>"u")return;const n=window;n.dataLayer=n.dataLayer||[],n.dataLayer.push({event:y,meta_event:t,[s]:!0,...e})}function v(t,e={}){if(W(t,e),typeof window>"u")return;const n=window.fbq;typeof n=="function"&&n("track",t,{...e,[s]:!0})}function w(t,e,n){v(t,{...B(e),...n})}function p(t){const{transaction_id:e,...n}=t;w(o.Purchase,n,{order_id:e})}const X={add_to_cart:o.AddToCart,view_item:o.ViewContent,view_cart:o.ViewContent,begin_checkout:o.InitiateCheckout,add_payment_info:o.AddPaymentInfo,purchase:o.Purchase};function A(t){if(typeof window>"u")return;const e=window;e.dataLayer=e.dataLayer||[],e.dataLayer.push({ecommerce:null}),e.dataLayer.push(t)}function k(t){return(t??"INR").toUpperCase()}function T(t){const e=t.items??[],n=e.reduce((i,c)=>i+(c.quantity??1),0);return{currency:k(t.currency),value:t.value,content_ids:e.map(i=>String(i.item_id)),content_type:"product",contents:e.map(i=>({id:String(i.item_id),quantity:i.quantity??1,item_price:i.price??0})),num_items:n}}function d(t,e,n){const i=k(e.currency),c={...e,currency:i},a=T({...e,currency:i});A({event:t,ecommerce:c,...a,...n});const u=X[t];u&&(t==="purchase"&&(n!=null&&n.transaction_id)?p({...e,currency:i,transaction_id:String(n.transaction_id)}):w(u,{...e,currency:i},n))}function f(t,e){v(t,e??{})}function g(t){var c,a;if(!((c=t==null?void 0:t.items)!=null&&c.length))return null;const e=k(t.currency_code??((a=t.region)==null?void 0:a.currency_code)),n=(t.total??0)/100,i=t.items.map((u,ut)=>{const at=u.total&&u.quantity?u.total/u.quantity:0;return{item_id:u.variant_id??u.id,item_name:u.title??u.product_title??"",price:at/100,quantity:u.quantity,index:ut}});return{currency:e,value:n,items:i}}function Y(t){d("add_to_cart",t)}function K(t){d("remove_from_cart",t)}function S(t){d("view_cart",t)}function O(t){d("view_item",t)}function H(t){const e=T({currency:"INR",value:0,items:t.items});A({event:"view_item_list",ecommerce:t,...e}),w(o.ViewContent,{currency:"INR",value:0,items:t.items})}const I="meta_initiate_checkout_";function L(t){typeof window>"u"||sessionStorage.setItem(`${I}${t}`,String(Date.now()))}function z(t,e=6e4){if(typeof window>"u")return!1;const n=sessionStorage.getItem(`${I}${t}`);return n?Date.now()-Number(n)<e:!1}function J(t,e){P(t),e&&L(e)}function P(t){d("begin_checkout",t)}function Q(t){d("add_shipping_info",t)}function Z(t,e){d("add_payment_info",t,e)}function x(t){const{transaction_id:e,...n}=t;d("purchase",n,{transaction_id:e,order_id:e})}function tt(t){f(o.AddToWishlist,{content_ids:t.content_ids,content_type:"product",currency:k(t.currency),value:t.value??0})}function et(t){f(o.CompleteRegistration,t)}function nt(t){f(o.Contact,t)}function it(t){f(o.Lead,t)}function rt(t){f(o.Search,{search_string:t})}function ct(t){f(o.ViewContent,{content_type:"cta",content_name:t.label||"shop_now",content_category:"hero_banner",...t.link?{content_url:t.link}:{}})}function ot(t){const e=g(t);e&&S(e)}r.META_EXPLICIT_KEY=s,r.META_PIXEL_DATALAYER_EVENT=y,r.META_STANDARD_EVENTS=o,r.cartToEcommercePayload=g,r.composeAnalyticsAdapters=R,r.createGtmAnalyticsAdapter=C,r.defaultStorefrontAnalytics=M,r.disableMetaPixelAutoConfig=E,r.emitContactFormSubmitted=V,r.emitFormSubmitted=l,r.emitLeadCaptured=D,r.emitReviewSubmitted=N,r.fireMetaEcommerceEvent=w,r.fireMetaPixelEvent=v,r.fireMetaPurchase=p,r.initGTM=F,r.installMetaPixelGuard=j,r.markInitiateCheckoutFired=L,r.noopAnalyticsAdapter=_,r.pushToDataLayer=h,r.trackAddPaymentInfo=Z,r.trackAddShippingInfo=Q,r.trackAddToCart=Y,r.trackAddToWishlist=tt,r.trackBeginCheckout=P,r.trackCartNavClick=ot,r.trackCompleteRegistration=et,r.trackContact=nt,r.trackEvent=q,r.trackGtmEvent=m,r.trackHeroCtaClick=ct,r.trackInitiateCheckoutFromCart=J,r.trackLead=it,r.trackMetaStandardEvent=f,r.trackPurchase=x,r.trackRemoveFromCart=K,r.trackSearch=rt,r.trackViewCart=S,r.trackViewItem=O,r.trackViewItemList=H,r.wasInitiateCheckoutFired=z,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "medusa-storefront-analytics",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Layered storefront analytics (GTM dataLayer) with reusable domain events for reviews, forms, and more.",
|
|
5
|
+
"author": "SmartByte Labs",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": ["medusa", "storefront", "analytics", "gtm", "dataLayer", "reviews"],
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/SmartByteLabs/medusa-ui-components.git",
|
|
11
|
+
"directory": "medusa-storefront-analytics"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"sideEffects": ["dist/**/*.js"],
|
|
18
|
+
"main": "./dist/ui-library.umd.cjs",
|
|
19
|
+
"module": "./dist/ui-library.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/ui-library.js",
|
|
25
|
+
"require": "./dist/ui-library.umd.cjs",
|
|
26
|
+
"default": "./dist/ui-library.js"
|
|
27
|
+
},
|
|
28
|
+
"./gtm": {
|
|
29
|
+
"types": "./dist/providers/gtm.d.ts",
|
|
30
|
+
"import": "./dist/ui-library.js",
|
|
31
|
+
"default": "./dist/ui-library.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": ["dist"],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc && vite build",
|
|
37
|
+
"dev": "vite build --watch"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"typescript": "^5.0.0",
|
|
41
|
+
"vite": "^5.0.0",
|
|
42
|
+
"vite-plugin-dts": "^3.0.0"
|
|
43
|
+
}
|
|
44
|
+
}
|