Send event when adding product to Cart
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user