MediaJel / mediajel-tracker

hosted mediajel tracker
4 stars 1 forks source link

Add new snowplow events for previous carts #169

Open pacholoamit opened 1 year ago

pacholoamit commented 1 year ago

Description

pacholoamit commented 1 year ago

Update: Take a look at the tag generator for the events

jonmediajel commented 2 months ago

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

Image Image

*UPDATE: Already added the minified version on the microservice

jonmediajel commented 2 months ago

https://github.com/MediaJel/amplication-nestjs-microservices/pull/550 - shopify updates on amplication

jonmediajel commented 2 months ago

remove to cart now exist for dutchie iframe

Image

jonmediajel commented 2 months ago

Added - Add to cart and remove to cart on SWEED

https://github.com/MediaJel/mediajel-tracker/pull/514

jonmediajel commented 1 month ago

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

Image

Should we continue on with the add & remove to cart even though price is undefined?

jonmediajel commented 1 month ago

Jane - Add to Cart via post message doesn't have also Price

Image

jonmediajel commented 1 month ago

Note: to Add to cart and Remove to cart. If it hasn't have price value. Would default to 0

jonmediajel commented 1 month ago

Note: Add other cart environments imports to BING / GOOGLE

jonmediajel commented 1 month ago

Dutchie Subdomain - add and remove to cart price fix completed Jane - add and remove to cart price fix completed

jonmediajel commented 1 month ago

Note: Update the KPI events from each update carts

jonmediajel commented 1 month ago

Updated KPI: https://github.com/MediaJel/mediajel-tracker/pull/534

jonmediajel commented 1 month ago

https://github.com/MediaJel/mediajel-tracker/pull/539

dutchie plus add and remove to cart

Image

pacholoamit commented 2 weeks ago

UPdate: Break ticket into smaller pieces

jonmediajel commented 1 week ago

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