Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@firestitch/analytics

Package Overview
Dependencies
Maintainers
7
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firestitch/analytics - npm Package Compare versions

Comparing version 12.3.5 to 12.3.6

4

app/enums/event-type.d.ts
export declare enum EventType {
BeginCheckout = "beginCheckout",
AddToCart = "addToCart",
RemoveFromCart = "removeFromCart",
AddPayment = "addPayment",
Purcahse = "purchase"
}

@@ -7,5 +7,31 @@ export interface PurchaseEvent {

currency?: string;
products?: PurchaseEventProduct[];
items?: Item[];
}
export interface PurchaseEventProduct {
export interface BeginCheckoutEvent {
currency?: string;
total?: number;
items?: Item[];
}
export interface AddToCartEvent {
currency?: string;
total?: number;
items?: Item[];
}
export interface RemoveFromCartEvent {
currency?: string;
total?: number;
items?: Item[];
}
export interface RemoveFromCartEvent {
currency?: string;
total?: number;
items?: Item[];
}
export interface AppPaymentEvent {
currency?: string;
total?: number;
paymentType?: string;
items?: Item[];
}
export interface Item {
id?: string;

@@ -12,0 +38,0 @@ name?: string;

@@ -10,2 +10,9 @@ import { Provider } from "./provider";

get scriptDomain(): string;
private _mapPurchaseEventData;
private _mapBeginCheckoutEventData;
private _mapAddToCartEventData;
private _mapRemoveFromCartEventData;
private _mapAddPaymentEventData;
private _mapItems;
private _mapEventData;
}
import { Injector } from '@angular/core';
import { Router } from '@angular/router';
import { FsAnalyticsConfig, PurchaseEvent } from '../interfaces';
import { AddToCartEvent, AppPaymentEvent, BeginCheckoutEvent, FsAnalyticsConfig, PurchaseEvent, RemoveFromCartEvent } from '../interfaces';
import * as i0 from "@angular/core";

@@ -13,2 +13,6 @@ export declare class FsAnalytics {

init(): void;
addToCart(data: AddToCartEvent): void;
addPayment(data: AppPaymentEvent): void;
removeFromCart(data: RemoveFromCartEvent): void;
beginCheckout(event: BeginCheckoutEvent): void;
purchase(event: PurchaseEvent): void;

@@ -15,0 +19,0 @@ trackEvent(type: string, data?: any): void;

134

bundles/firestitch-analytics.umd.js

@@ -30,2 +30,6 @@ (function (global, factory) {

(function (EventType) {
EventType["BeginCheckout"] = "beginCheckout";
EventType["AddToCart"] = "addToCart";
EventType["RemoveFromCart"] = "removeFromCart";
EventType["AddPayment"] = "addPayment";
EventType["Purcahse"] = "purchase";

@@ -419,3 +423,3 @@ })(exports.EventType || (exports.EventType = {}));

value: prucahseEvent.total,
contents: prucahseEvent.products
contents: prucahseEvent.items
.map(function (product) { return ({

@@ -508,3 +512,3 @@ id: product.id,

currency: prucahseEvent.currency,
items: prucahseEvent.products
items: prucahseEvent.items
.map(function (product) { return ({

@@ -572,28 +576,4 @@ item_id: product.id,

GoogleTagManagerProvider.prototype.trackEvent = function (type, value, options) {
var data = {
value: value,
category: options === null || options === void 0 ? void 0 : options.category,
label: options === null || options === void 0 ? void 0 : options.label,
};
if (type === exports.EventType.Purcahse) {
var purchaseEvent = value;
data = {
ecommerce: {
transaction_id: purchaseEvent.transactionId,
value: purchaseEvent.total,
tax: purchaseEvent.tax,
shipping: purchaseEvent.shipping,
currency: purchaseEvent.currency,
items: purchaseEvent.products
.map(function (product) { return ({
item_id: product.id,
item_name: product.name,
price: product.price,
quantity: product.quantity,
item_category: product.category,
item_category2: product.category2,
}); }),
}
};
}
var data = this._mapEventData(type, value, options);
this.window.dataLayer.push({ ecommerce: null });
this.window.dataLayer.push(Object.assign({ event: type }, data));

@@ -618,2 +598,84 @@ };

});
GoogleTagManagerProvider.prototype._mapPurchaseEventData = function (value) {
return {
ecommerce: {
transaction_id: value.transactionId,
value: value.total,
tax: value.tax,
shipping: value.shipping,
currency: value.currency,
items: this._mapItems(value.items),
}
};
};
GoogleTagManagerProvider.prototype._mapBeginCheckoutEventData = function (value) {
return {
ecommerce: {
value: value.total,
currency: value.currency,
items: this._mapItems(value.items),
}
};
};
GoogleTagManagerProvider.prototype._mapAddToCartEventData = function (value) {
return {
ecommerce: {
value: value.total,
currency: value.currency,
items: this._mapItems(value.items),
}
};
};
GoogleTagManagerProvider.prototype._mapRemoveFromCartEventData = function (value) {
return {
ecommerce: {
value: value.total,
currency: value.currency,
items: this._mapItems(value.items),
}
};
};
GoogleTagManagerProvider.prototype._mapAddPaymentEventData = function (value) {
return {
ecommerce: {
value: value.total,
currency: value.currency,
payment_type: value.paymentType,
items: this._mapItems(value.items),
}
};
};
GoogleTagManagerProvider.prototype._mapItems = function (items) {
return items
.map(function (item) { return ({
item_id: item.id,
item_name: item.name,
price: item.price,
quantity: item.quantity,
item_category: item.category,
item_category2: item.category2,
}); });
};
GoogleTagManagerProvider.prototype._mapEventData = function (type, value, options) {
if (type === exports.EventType.Purcahse) {
return this._mapPurchaseEventData(value);
}
else if (type === exports.EventType.BeginCheckout) {
return this._mapBeginCheckoutEventData(value);
}
else if (type === exports.EventType.AddPayment) {
return this._mapAddPaymentEventData(value);
}
else if (type === exports.EventType.AddToCart) {
return this._mapAddToCartEventData(value);
}
else if (type === exports.EventType.RemoveFromCart) {
return this._mapRemoveFromCartEventData(value);
}
return {
value: value,
category: options === null || options === void 0 ? void 0 : options.category,
label: options === null || options === void 0 ? void 0 : options.label,
};
};
return GoogleTagManagerProvider;

@@ -715,4 +777,18 @@ }(Provider));

};
FsAnalytics.prototype.addToCart = function (data) {
this.trackEvent(exports.EventType.AddToCart, data);
};
FsAnalytics.prototype.addPayment = function (data) {
this.trackEvent(exports.EventType.AddPayment, data);
};
FsAnalytics.prototype.removeFromCart = function (data) {
this.trackEvent(exports.EventType.RemoveFromCart, data);
};
FsAnalytics.prototype.beginCheckout = function (event) {
event = Object.assign(Object.assign({}, event), { total: event.total || 0, items: (event.items || [])
.map(function (product) { return (Object.assign(Object.assign({}, product), { price: product.price || 0, quantity: product.quantity || 1 })); }) });
this.trackEvent(exports.EventType.Purcahse, event);
};
FsAnalytics.prototype.purchase = function (event) {
event = Object.assign(Object.assign({}, event), { total: event.total || 0, shipping: event.shipping || 0, tax: event.tax || 0, products: (event.products || [])
event = Object.assign(Object.assign({}, event), { total: event.total || 0, shipping: event.shipping || 0, tax: event.tax || 0, items: (event.items || [])
.map(function (product) { return (Object.assign(Object.assign({}, product), { price: product.price || 0, quantity: product.quantity || 1 })); }) });

@@ -719,0 +795,0 @@ this.trackEvent(exports.EventType.Purcahse, event);

export var EventType;
(function (EventType) {
EventType["BeginCheckout"] = "beginCheckout";
EventType["AddToCart"] = "addToCart";
EventType["RemoveFromCart"] = "removeFromCart";
EventType["AddPayment"] = "addPayment";
EventType["Purcahse"] = "purchase";
})(EventType || (EventType = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXZlbnQtdHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9hcHAvZW51bXMvZXZlbnQtdHlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQU4sSUFBWSxTQUVYO0FBRkQsV0FBWSxTQUFTO0lBQ25CLGtDQUFxQixDQUFBO0FBQ3ZCLENBQUMsRUFGVyxTQUFTLEtBQVQsU0FBUyxRQUVwQiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBlbnVtIEV2ZW50VHlwZSB7XG4gIFB1cmNhaHNlID0gJ3B1cmNoYXNlJyxcbn0iXX0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXZlbnQtdHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9hcHAvZW51bXMvZXZlbnQtdHlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQU4sSUFBWSxTQU1YO0FBTkQsV0FBWSxTQUFTO0lBQ25CLDRDQUErQixDQUFBO0lBQy9CLG9DQUF1QixDQUFBO0lBQ3ZCLDhDQUFpQyxDQUFBO0lBQ2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k/OiBzdHJpbmcsXG4gIHRvdGFsPzogbnVtYmVyLFxuICBwYXltZW50VHlwZT86IHN0cmluZyxcbiAgaXRlbXM/OiBJdGVtW10sXG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgSXRlbSB7XG4gIGlkPzogc3RyaW5nLFxuICBuYW1lPzogc3RyaW5nLFxuICBwcmljZT86IG51bWJlcixcbiAgcXVhbnRpdHk/OiBudW1iZXIsXG4gIGNhdGVnb3J5Pzogc3RyaW5nLFxuICBjYXRlZ29yeTI/OiBzdHJpbmcsXG59XG4iXX0=

@@ -16,3 +16,3 @@ import { EventType } from "../enums";

value: prucahseEvent.total,
contents: prucahseEvent.products
contents: prucahseEvent.items
.map((product) => ({

@@ -68,2 +68,2 @@ id: product.id,

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjZWJvb2stcGl4ZWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXBwL3Byb3ZpZGVycy9mYWNlYm9vay1waXhlbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sVUFBVSxDQUFDO0FBRXJDLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFNdEMsTUFBTSxPQUFPLHFCQUFzQixTQUFRLFFBQVE7SUFFMUMsSUFBSTtRQUNULElBQUksQ0FBQyxTQUFTLEVBQUUsQ0FBQztRQUNqQixJQUFJLENBQUMsTUFBTSxFQUFFLENBQUM7SUFDaEIsQ0FBQztJQUVNLFVBQVUsQ0FBQyxJQUF3QixFQUFFLEtBQU0sRUFBRSxPQUFRO1FBQzFELElBQUksSUFBSSxtQ0FDSCxPQUFPLEtBQ1YsS0FBSyxHQUNOLENBQUM7UUFFRixJQUFJLElBQUksS0FBSyxTQUFTLENBQUMsUUFBUSxFQUFFO1lBQy9CLE1B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ZSgnaGVpZ2h0JywgJzEnKTtcbiAgICBpbWcuc2V0QXR0cmlidXRlKCd3aWR0aCcsICcxJyk7XG4gICAgaW1nLnNldEF0dHJpYnV0ZSgnc3R5bGUnLCAnZGlzcGxheTpub25lJyk7XG4gICAgaW1nLnNldEF0dHJpYnV0ZSgnc3JjJywgYGh0dHBzOi8vd3d3LmZhY2Vib29rLmNvbS90cj9pZD0ke3RoaXMucGl4ZWxJZH0mZXY9UGFnZVZpZXcmbm9zY3JpcHQ9MWApO1xuICAgIHZhciBub3NjcmlwdCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ25vc2NyaXB0Jyk7XG4gICAgbm9zY3JpcHQuYXBwZW5kKGltZyk7XG4gICAgdGhpcy5hcHBlbmRIZWFkKG5vc2NyaXB0KTtcbiAgfVxuXG4gIHB1YmxpYyBnZXQgcGl4ZWxJZCgpIHtcbiAgICByZXR1cm4gdGhpcy5fY29uZmlnLnByb3ZpZGVycy5mYWNlYm9va1BpeGVsPy5waXhlbElkO1xuICB9XG59Il19

@@ -29,3 +29,3 @@ import { EventType } from "../enums";

currency: prucahseEvent.currency,
items: prucahseEvent.products
items: prucahseEvent.items
.map((product) => ({

@@ -57,2 +57,2 @@ item_id: product.id,

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ29vZ2xlLWFuYWx5dGljcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9hcHAvcHJvdmlkZXJzL2dvb2dsZS1hbmFseXRpY3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLFVBQVUsQ0FBQztBQUVyQyxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sWUFBWSxDQUFDO0FBS3RDLE1BQU0sT0FBTyx1QkFBd0IsU0FBUSxRQUFRO0lBRTVDLElBQUk7UUFD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mlkZXJzLmdvb2dsZUFuYWx5dGljcz8ubWVhc3VyZW1lbnRJZDtcbiAgfVxufSJdfQ==

@@ -24,28 +24,4 @@ import { Provider } from "./provider";

trackEvent(type, value, options) {
let data = {
value,
category: options === null || options === void 0 ? void 0 : options.category,
label: options === null || options === void 0 ? void 0 : options.label,
};
if (type === EventType.Purcahse) {
const purchaseEvent = value;
data = {
ecommerce: {
transaction_id: purchaseEvent.transactionId,
value: purchaseEvent.total,
tax: purchaseEvent.tax,
shipping: purchaseEvent.shipping,
currency: purchaseEvent.currency,
items: purchaseEvent.products
.map((product) => ({
item_id: product.id,
item_name: product.name,
price: product.price,
quantity: product.quantity,
item_category: product.category,
item_category2: product.category2,
})),
}
};
}
const data = this._mapEventData(type, value, options);
this.window.dataLayer.push({ ecommerce: null });
this.window.dataLayer.push(Object.assign({ event: type }, data));

@@ -62,3 +38,85 @@ }

}
_mapPurchaseEventData(value) {
return {
ecommerce: {
transaction_id: value.transactionId,
value: value.total,
tax: value.tax,
shipping: value.shipping,
currency: value.currency,
items: this._mapItems(value.items),
}
};
}
_mapBeginCheckoutEventData(value) {
return {
ecommerce: {
value: value.total,
currency: value.currency,
items: this._mapItems(value.items),
}
};
}
_mapAddToCartEventData(value) {
return {
ecommerce: {
value: value.total,
currency: value.currency,
items: this._mapItems(value.items),
}
};
}
_mapRemoveFromCartEventData(value) {
return {
ecommerce: {
value: value.total,
currency: value.currency,
items: this._mapItems(value.items),
}
};
}
_mapAddPaymentEventData(value) {
return {
ecommerce: {
value: value.total,
currency: value.currency,
payment_type: value.paymentType,
items: this._mapItems(value.items),
}
};
}
_mapItems(items) {
return items
.map((item) => ({
item_id: item.id,
item_name: item.name,
price: item.price,
quantity: item.quantity,
item_category: item.category,
item_category2: item.category2,
}));
}
_mapEventData(type, value, options) {
if (type === EventType.Purcahse) {
return this._mapPurchaseEventData(value);
}
else if (type === EventType.BeginCheckout) {
return this._mapBeginCheckoutEventData(value);
}
else if (type === EventType.AddPayment) {
return this._mapAddPaymentEventData(value);
}
else if (type === EventType.AddToCart) {
return this._mapAddToCartEventData(value);
}
else if (type === EventType.RemoveFromCart) {
return this._mapRemoveFromCartEventData(value);
}
return {
value,
category: options === null || options === void 0 ? void 0 : options.category,
label: options === null || options === void 0 ? void 0 : options.label,
};
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ29vZ2xlLXRhZy1tYW5hZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2FwcC9wcm92aWRlcnMvZ29vZ2xlLXRhZy1tYW5hZ2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFFdEMsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLFVBQVUsQ0FBQztBQUlyQyxNQUFNLE9BQU8sd0JBQXlCLFNBQVEsUUFBUTtJQUU3QyxJQUFJO1FBQ1QsSUFBSSxJQUFJLENBQUMsV0FBVyxFQUFFO1lBQ3BCLE1BQU0sWUFBWSxHQUFHLElBQUksQ0FBQyxZQUFZLElBQUksMEJBQTBCLENBQUM7WUFDckUsSUFBSSxDQUFDLFNBQVMsQ0FBQyxXQUFXLFlBQVksY0FBYyxJQUFJLENBQUMsV0FBVyxFQUFFLENBQUMsQ0FBQztZQUN4RSxJQUFJLENBQUMsTUFBTSxDQUFDLFNBQVMsR0FBRyxJQUFJLENBQUMsTUFBTSxDQUFDLFNBQVMsSUFBSSxFQUFFLENBQUM7WUFFcEQsSUFBSSxDQUFDLFFBQVEsQ0FBQyxJQUFJLEVBQUUsSUFBSSxJQUFJLEVBQUUsQ0FBQyxDQUFDO1lBQ2hDLElBQUksQ0FBQyxRQUFRLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxXQUFXLEVBQUUsRUFBRSxTQUFTLEVBQUUsSUFBSSxDQUFDL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O1xuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICB2YWx1ZSxcbiAgICAgIGNhdGVnb3J5OiBvcHRpb25zPy5jYXRlZ29yeSxcbiAgICAgIGxhYmVsOiBvcHRpb25zPy5sYWJlbCxcbiAgICB9IGFzIGFueTtcbiAgfVxufSJdfQ==

@@ -35,4 +35,18 @@ import { Inject, Injectable, Injector } from '@angular/core';

}
addToCart(data) {
this.trackEvent(EventType.AddToCart, data);
}
addPayment(data) {
this.trackEvent(EventType.AddPayment, data);
}
removeFromCart(data) {
this.trackEvent(EventType.RemoveFromCart, data);
}
beginCheckout(event) {
event = Object.assign(Object.assign({}, event), { total: event.total || 0, items: (event.items || [])
.map((product) => (Object.assign(Object.assign({}, product), { price: product.price || 0, quantity: product.quantity || 1 }))) });
this.trackEvent(EventType.Purcahse, event);
}
purchase(event) {
event = Object.assign(Object.assign({}, event), { total: event.total || 0, shipping: event.shipping || 0, tax: event.tax || 0, products: (event.products || [])
event = Object.assign(Object.assign({}, event), { total: event.total || 0, shipping: event.shipping || 0, tax: event.tax || 0, items: (event.items || [])
.map((product) => (Object.assign(Object.assign({}, product), { price: product.price || 0, quantity: product.quantity || 1 }))) });

@@ -68,2 +82,2 @@ this.trackEvent(EventType.Purcahse, event);

}] }, { type: i0.Injector }, { type: i1.Router }]; } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5hbHl0aWNzLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXBwL3NlcnZpY2VzL2FuYWx5dGljcy5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsVUFBVSxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUM3RCxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0saUJBQWlCLENBQUM7Q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FR5cGUuUHVyY2Foc2UsIGV2ZW50KTtcbiAgfVxuXG4gIHB1YmxpYyB0cmFja0V2ZW50KHR5cGU6IHN0cmluZywgZGF0YT86IGFueSkge1xuICAgIHRoaXMuX3Byb2Nlc3NvclNlcnZpY2UucHJvY2Vzcyh7IHR5cGUsIGRhdGEgfSlcbiAgICAgIC5waXBlKFxuICAgICAgICB0YWtlKDEpLFxuICAgICAgKVxuICAgICAgLnN1YnNjcmliZSgoKSA9PiB7XG4gICAgICAgIHRoaXMuX3Byb3ZpZGVyc1xuICAgICAgICAgIC5mb3JFYWNoKChwcm92aWRlcikgPT4ge1xuICAgICAgICAgICAgcHJvdmlkZXIudHJhY2tFdmVudCh0eXBlLCBkYXRhKTtcbiAgICAgICAgICB9KTtcbiAgICAgIH0pO1xuICB9XG5cbiAgcHVibGljIHNldFVzZXIoZGF0YSkge1xuICAgIHRoaXMuX3Byb3ZpZGVycy5mb3JFYWNoKChwcm92aWRlcikgPT4ge1xuICAgICAgcHJvdmlkZXIuc2V0VXNlcihkYXRhKTtcbiAgICB9KTtcbiAgfVxufVxuIl19

@@ -10,2 +10,6 @@ import * as i0 from '@angular/core';

(function (EventType) {
EventType["BeginCheckout"] = "beginCheckout";
EventType["AddToCart"] = "addToCart";
EventType["RemoveFromCart"] = "removeFromCart";
EventType["AddPayment"] = "addPayment";
EventType["Purcahse"] = "purchase";

@@ -61,3 +65,3 @@ })(EventType || (EventType = {}));

value: prucahseEvent.total,
contents: prucahseEvent.products
contents: prucahseEvent.items
.map((product) => ({

@@ -140,3 +144,3 @@ id: product.id,

currency: prucahseEvent.currency,
items: prucahseEvent.products
items: prucahseEvent.items
.map((product) => ({

@@ -190,28 +194,4 @@ item_id: product.id,

trackEvent(type, value, options) {
let data = {
value,
category: options === null || options === void 0 ? void 0 : options.category,
label: options === null || options === void 0 ? void 0 : options.label,
};
if (type === EventType.Purcahse) {
const purchaseEvent = value;
data = {
ecommerce: {
transaction_id: purchaseEvent.transactionId,
value: purchaseEvent.total,
tax: purchaseEvent.tax,
shipping: purchaseEvent.shipping,
currency: purchaseEvent.currency,
items: purchaseEvent.products
.map((product) => ({
item_id: product.id,
item_name: product.name,
price: product.price,
quantity: product.quantity,
item_category: product.category,
item_category2: product.category2,
})),
}
};
}
const data = this._mapEventData(type, value, options);
this.window.dataLayer.push({ ecommerce: null });
this.window.dataLayer.push(Object.assign({ event: type }, data));

@@ -228,2 +208,84 @@ }

}
_mapPurchaseEventData(value) {
return {
ecommerce: {
transaction_id: value.transactionId,
value: value.total,
tax: value.tax,
shipping: value.shipping,
currency: value.currency,
items: this._mapItems(value.items),
}
};
}
_mapBeginCheckoutEventData(value) {
return {
ecommerce: {
value: value.total,
currency: value.currency,
items: this._mapItems(value.items),
}
};
}
_mapAddToCartEventData(value) {
return {
ecommerce: {
value: value.total,
currency: value.currency,
items: this._mapItems(value.items),
}
};
}
_mapRemoveFromCartEventData(value) {
return {
ecommerce: {
value: value.total,
currency: value.currency,
items: this._mapItems(value.items),
}
};
}
_mapAddPaymentEventData(value) {
return {
ecommerce: {
value: value.total,
currency: value.currency,
payment_type: value.paymentType,
items: this._mapItems(value.items),
}
};
}
_mapItems(items) {
return items
.map((item) => ({
item_id: item.id,
item_name: item.name,
price: item.price,
quantity: item.quantity,
item_category: item.category,
item_category2: item.category2,
}));
}
_mapEventData(type, value, options) {
if (type === EventType.Purcahse) {
return this._mapPurchaseEventData(value);
}
else if (type === EventType.BeginCheckout) {
return this._mapBeginCheckoutEventData(value);
}
else if (type === EventType.AddPayment) {
return this._mapAddPaymentEventData(value);
}
else if (type === EventType.AddToCart) {
return this._mapAddToCartEventData(value);
}
else if (type === EventType.RemoveFromCart) {
return this._mapRemoveFromCartEventData(value);
}
return {
value,
category: options === null || options === void 0 ? void 0 : options.category,
label: options === null || options === void 0 ? void 0 : options.label,
};
}
}

@@ -312,4 +374,18 @@

}
addToCart(data) {
this.trackEvent(EventType.AddToCart, data);
}
addPayment(data) {
this.trackEvent(EventType.AddPayment, data);
}
removeFromCart(data) {
this.trackEvent(EventType.RemoveFromCart, data);
}
beginCheckout(event) {
event = Object.assign(Object.assign({}, event), { total: event.total || 0, items: (event.items || [])
.map((product) => (Object.assign(Object.assign({}, product), { price: product.price || 0, quantity: product.quantity || 1 }))) });
this.trackEvent(EventType.Purcahse, event);
}
purchase(event) {
event = Object.assign(Object.assign({}, event), { total: event.total || 0, shipping: event.shipping || 0, tax: event.tax || 0, products: (event.products || [])
event = Object.assign(Object.assign({}, event), { total: event.total || 0, shipping: event.shipping || 0, tax: event.tax || 0, items: (event.items || [])
.map((product) => (Object.assign(Object.assign({}, product), { price: product.price || 0, quantity: product.quantity || 1 }))) });

@@ -316,0 +392,0 @@ this.trackEvent(EventType.Purcahse, event);

{
"name": "@firestitch/analytics",
"version": "12.3.5",
"version": "12.3.6",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc