in src/web-ui/src/analytics/AnalyticsHandler.js [455:523]
productRemovedFromCart(user, cart, cartItem, origQuantity) {
if (user && user.id) {
AmplifyAnalytics.record({
name: 'ProductRemoved',
attributes: {
userId: user.id,
cartId: cart.id,
productId: cartItem.product_id
},
metrics: {
quantity: origQuantity,
price: +cartItem.price.toFixed(2)
}
})
AmplifyAnalytics.updateEndpoint({
userId: user.id,
userAttributes: {
HasShoppingCart: cart.items.length > 0 ? ['true'] : ['false']
},
metrics: {
ItemsInCart: cart.items.length
}
})
}
let eventProperties = {
cartId: cart.id,
productId: cartItem.product_id,
quantity: origQuantity,
price: +cartItem.price.toFixed(2)
};
if (this.mParticleEnabled()) {
let product1 = window.mParticle.eCommerce.createProduct(
cartItem.product_name, // Name
cartItem.product_id, // SKU
cartItem.price, // Price
origQuantity // Quantity
);
window.mParticle.eCommerce.logProductAction(window.mParticle.ProductActionType.RemoveFromCart, product1, {mpid: window.mParticle.Identity.getCurrentUser().getMPID()},{},{});
}
if (this.segmentEnabled()) {
window.analytics.track('ProductRemoved', eventProperties);
}
if (this.amplitudeEnabled()) {
Amplitude.getInstance().logEvent('ProductRemoved', eventProperties);
}
if (this.googleAnalyticsEnabled()) {
Vue.prototype.$gtag.event('remove_from_cart', {
"currency": "USD",
"value": +cartItem.price.toFixed(2),
"items": [
{
"item_id": cartItem.product_id,
"item_name": cartItem.product_name,
"quantity": origQuantity,
"currency": "USD",
"price": +cartItem.price.toFixed(2)
}
]
});
}
},