snowplow-javascript-tracker
snowplow-javascript-tracker copied to clipboard
Introduce Ecommerce Accelerator browser plugin
Description
Initial draft on the Ecommerce Accelerator browser plugin.
Initial API
Used for: | Expected usage: | |
---|---|---|
trackProductView | Tracking a visit to a product page. Known also as product detail view. | trackProductView({id: 'P1234', price: 25, currency: 'EUR', brand: 'Snowplow', }); |
trackAddToCart | Track an addition to cart. | trackAddToCart({ total_value: 40, currency: 'EUR', products: [{ id: 'P1234', price: 12,currency: 'EUR' }]}); |
trackRemoveFromCart | Track a removal from cart. | trackRemoveFromCart({ total_value: 40,currency: 'EUR',products: [{ id: 'P1234',price: 12,currency: 'EUR' }]}); |
trackProductListView | Track an impression of a product list. The list could be a search results page, recommended products, upsells etc. | trackProductListView({ name: 'shop the look', products: [ { id: 'P1234', price: 12, currency: 'EUR', position: 1 },{ id: 'P1235', price: 14, currency: 'EUR', position: 2 }, ], }); |
trackProductListClick | Track the click/selection of a product from a product list. | trackProductListClick({ name: 'shop the look', product: { id: 'P1235', price: 14, currency: 'EUR', position: 2 } }); |
trackCheckoutStep | Track a checkout step completion in the checkout process together with common step attributes for user choices throughout the checkout funnel. | trackCheckoutStep({ step: 2, delivery_method: 'express delivery', delivery_provider: 'PostNL' }); |
trackTransaction | Track a transaction/purchase completion. | trackTransaction({ transaction_id: 'T123', currency: 'EUR', revenue: 26, payment_method: 'Alipay', products: [{ id: 'P1234', price: 12, currency: 'EUR', position: 1 }, { id: 'P1235', price: 14, currency: 'EUR', position: 2 } ]}); |
setPageType | Set a Page type context which would allow the analyst to discern between types of pages with ecommerce value. E.g. Category Page, Product Page, Cart Page, etc. | setPageType({ type: 'cart', locale: 'en' }); |
setEcommerceUser | Set a User type context with a few standard user attributes. | setEcommerceUser({ id: 'U123', is_guest: true }); |
BundleMon
Files added (6)
Status | Path | Size | Limits |
---|---|---|---|
:white_check_mark: | libraries/browser-tracker-core/dist/index.mod ule.js |
+23.8KB | 25KB / +10% |
:white_check_mark: | trackers/javascript-tracker/dist/sp.js |
+23.49KB | 25KB / +10% |
:white_check_mark: | trackers/javascript-tracker/dist/sp.lite.js |
+14.2KB | 15KB / +10% |
:white_check_mark: | trackers/browser-tracker/dist/index.umd.min.j s |
+14.05KB | 15KB / +10% |
:white_check_mark: | libraries/tracker-core/dist/index.module.js |
+13.35KB | 15KB / +10% |
:white_check_mark: | trackers/browser-tracker/dist/index.module.js |
+3.46KB | 5KB / +10% |
Total files change +92.34KB 0%
Final result: :white_check_mark:
View report in BundleMon website ➡️
API looks good, I think Matus raises valuable questions and the naming is a pain which we need to sort soon. I think we can have some further discussions on what we want to call this, the dbt model and the accelerator before launch.