Skip to content

Instantly share code, notes, and snippets.

@elephantsneverforget
Last active September 11, 2023 16:51
Show Gist options
  • Save elephantsneverforget/cb40d59ae37b629042bd46e43b1cfe18 to your computer and use it in GitHub Desktop.
Save elephantsneverforget/cb40d59ae37b629042bd46e43b1cfe18 to your computer and use it in GitHub Desktop.
window.ElevarPushToDataLayer({
event: "dl_remove_from_cart",
ecommerce: {
currencyCode: "USD",
remove: {
actionField: {
list: location.pathname // this should be the collection page URL that user clicked product from
},
products: const products = [{
id: "LB00161-34689553170476", // SKU
name: "Lovebox Original Color & Photo", // Product title
brand: "Lovebox INC",
category: "Home,Living,Art & Objects,Tabletop",
variant: "USA wall plug",
price: "119.99",
quantity: "1", // Not required for dl_select_item & dl_view_item
position: item.position, // Only required for dl_select_item; position in the list of search results, collection views and position in cart indexed starting at 1
list: "/art/wallhangings", // The list the product was discovered from
product_id: "6979886940352", // The product_id
variant_id: "41141193965760", // id or variant_id
compare_at_price: "139.99", // If available on dl_view_item & dl_add_to_cart otherwise use "0.0"
image: "//cdn.shopify.com/small.png", // If available, otherwise use an empty string
inventory: "5" // If available, only required on dl_view_item
},
...
]
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment