From a01cab174db1220334ac09ad34553644fcbd9f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Thu, 3 Nov 2022 23:01:03 +0100 Subject: [PATCH] Send event when adding product to Cart --- src/utils/functions/shop.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/functions/shop.ts b/src/utils/functions/shop.ts index 86c63fb..653d913 100644 --- a/src/utils/functions/shop.ts +++ b/src/utils/functions/shop.ts @@ -1,6 +1,7 @@ import swell from 'swell-js' import { addNotification } from '$utils/functions/notifications' import { cartData } from '$utils/stores/shop' +import { sendEvent } from '$utils/analytics' import { PUBLIC_SWELL_STORE_ID, PUBLIC_SWELL_API_PUBLIC_TOKEN } from '$env/static/public' @@ -40,6 +41,11 @@ export const addToCart = async (product: any, quantity: number = 1) => { name: `${product.name} - x1`, image: product.images[0].file.url, }) + + // Send event + sendEvent('addToCart', { + product: product.name + }) } }