Open pacholoamit opened 1 year ago
Update: Take a look at the tag generator for the events
Version 1 - Shopify ( Add to cart and remove to cart )
analytics.subscribe('product_added_to_cart', (event) => {
var transaction = event.data.cartLine?.merchandise;
//v1
window.tracker(
"trackAddToCart",
(transaction.sku).toString() || "N/A",
(transaction.product.untranslatedTitle).toString() || "N/A",
"N/A",
parseFloat(transaction.price.amount) || 0,
parseInt(event.data.cartLine?.quantity) || 1,
(transaction.price.currencyCode).toString() || "USD"
);
});
analytics.subscribe("product_removed_from_cart", event => {
var transaction = event.data.cartLine?.merchandise;
//v1
window.tracker(
"trackRemoveFromCart",
(transaction.sku).toString() || "N/A",
(transaction.product.untranslatedTitle).toString() || "N/A",
"N/A",
parseFloat(transaction.price.amount) || 0,
parseInt(event.data.cartLine?.quantity) || 1,
(transaction.price.currencyCode).toString() || "USD"
);
});
Version 2 - Shopify ( Add to cart and remove to cart )
analytics.subscribe('product_added_to_cart', (event) => {
var transaction = event.data.cartLine?.merchandise;
//v2
window.tracker("trackAddToCart", {
sku: (transaction.sku).toString() || "N/A",
name: (transaction.product.untranslatedTitle).toString() || "N/A",
category: "N/A",
unitPrice: parseFloat(transaction.price.amount) || 0,
quantity: parseInt(event.data.cartLine?.quantity) || 1,
currency: (transaction.price.currencyCode).toString() || "USD",
});
});
analytics.subscribe("product_removed_from_cart", event => {
var transaction = event.data.cartLine?.merchandise;
//v2
window.tracker("trackRemoveFromCart", {
sku: (transaction.sku).toString() || "N/A",
name: (transaction.product.untranslatedTitle).toString() || "N/A",
category: "N/A",
unitPrice: parseFloat(transaction.price.amount) || 0,
quantity: parseInt(event.data.cartLine?.quantity) || 1,
currency: (transaction.price.currencyCode).toString() || "USD",
});
});
Will implement this on microservice - to be minified
*UPDATE: Already added the minified version on the microservice
https://github.com/MediaJel/amplication-nestjs-microservices/pull/550 - shopify updates on amplication
remove to cart now exist for dutchie iframe
Added - Add to cart and remove to cart on SWEED
Dutchie subdomain dataLayer seems has 2 kinds of approaches for Adding to cart
Scenario:
https://monroe-menu.thelandingdispensaries.com/stores/monroe-ohio/ - Success for Add / Remove to Cart on existing dutchie-subdomain tracker https://columbus-menu.thelandingdispensaries.com/stores/columbus-ohio - Fail to get Add / Remove to Cart on existing dutchie-subdomain tracker
On Columbus Menu - it seems we can track add to cart however there are no price / undefined
Should we continue on with the add & remove to cart even though price is undefined?
Jane - Add to Cart via post message doesn't have also Price
Note: to Add to cart and Remove to cart. If it hasn't have price value. Would default to 0
Note: Add other cart environments imports to BING / GOOGLE
Dutchie Subdomain - add and remove to cart price fix completed Jane - add and remove to cart price fix completed
Note: Update the KPI events from each update carts
https://github.com/MediaJel/mediajel-tracker/pull/539
dutchie plus add and remove to cart
UPdate: Break ticket into smaller pieces
Sweed add and remove cart
https://github.com/MediaJel/mediajel-tracker/pull/553
since the issue with google datalayer source has been fixed, bringing this back
Description