Appearance
Detecting e-commerce with dataLayer
If your store already pushes e-commerce data to window.dataLayer — the standard Google Tag Manager / GA4 pattern most e-commerce platforms and plugins use — the Prism snippet reads it directly and turns it into e-commerce events. There's usually nothing to configure: install the snippet and your funnel starts arriving.
What it reads
The snippet attaches to window.dataLayer on load (creating it if it doesn't exist yet, so load order with Google Tag Manager doesn't matter) and replays anything already pushed before it attached. From there it recognizes three shapes:
GA4 e-commerce events — the current standard, what GTM's e-commerce tags and most modern plugins emit:
js
dataLayer.push({
event: 'add_to_cart',
ecommerce: {
currency: 'USD',
value: 49.0,
items: [
{ item_id: 'SKU-123', item_name: 'Blue Mug', price: 49.0, quantity: 1 },
],
},
});Legacy Universal Analytics Enhanced Ecommerce — still common on stores that were never migrated off UA:
js
dataLayer.push({
ecommerce: {
add: { products: [{ id: 'SKU-123', price: 49.0, quantity: 1 }] },
},
});Direct gtag() calls — sites calling gtag('event', 'purchase', {...}) without a full GTM container, which push an array-like argument list rather than a plain object.
Event name mapping
| dataLayer event | Prism event |
|---|---|
view_item | ViewItem |
view_item_list | ViewItemList |
search (with a search term) | Search |
add_to_cart | AddToCart |
remove_from_cart | RemoveFromCart |
view_cart | ViewCart |
begin_checkout | BeginCheckout |
add_shipping_info | AddShippingInfo |
add_payment_info | AddPaymentInfo |
purchase | Purchase (transaction_id becomes order_id) |
The equivalent legacy Enhanced Ecommerce action fields (add, checkout, purchase.actionField, …) map to the same Prism events. Line items map item_id/id → contents[].id, price → item_price, quantity → quantity, and the snippet sums num_items and passes value/currency through. contents[].id is the field that has to match your ad platform's product catalog — see the catalog ID note in the event reference.
Each dataLayer push is treated as a complete snapshot of that event, not something to accumulate — so an ecommerce: null clear between pushes (a common GTM pattern) is handled correctly and never leaks items from a previous event into the next one.
What this means practically
If your store already has GA4 or Google Tag Manager e-commerce tracking set up, Prism captures your full funnel with no extra setup. This covers most WooCommerce stores running a GTM plugin, most Webflow e-commerce sites, and any custom or headless storefront that already pushes GA4-shaped e-commerce data. Shopify is the exception — checkout runs in a sandbox the dataLayer listener can't reach, so Shopify uses a dedicated pixel instead.
If a platform module also fires the same event (for example, a store-specific integration alongside a GTM container), Prism deduplicates matching events fired within a few seconds of each other before sending, so you won't see doubles from running both.
Verifying it's working
- Confirm your site already has GA4/GTM e-commerce tracking — open your browser console and check that
window.dataLayerexists and containsecommerceevents as you browse. - Browse a product page, add an item to cart, and check your Prism client's activity in the Adsidian dashboard for
ViewItemandAddToCartevents. - If nothing arrives, confirm the snippet is installed and see Troubleshooting.
Pushing events manually
For a custom cart with no GA4/GTM instrumentation, push GA4-shaped events onto dataLayer yourself — no separate API needed, the same listener picks them up:
js
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'add_to_cart',
ecommerce: {
currency: 'USD',
value: 49.0,
items: [
{ item_id: 'SKU-123', item_name: 'Blue Mug', price: 49.0, quantity: 1 },
],
},
});Or skip the dataLayer shape entirely and call window.prism('track', ...) directly — see the manual tracking example in the event reference.
Next
- E-commerce events — the full event reference and commerce properties
- Installing on Shopify — if the dataLayer listener doesn't apply to you