Step 3: Events
Events tell FitMyType what shoppers did after the size help: which size they put in the cart and which they
ordered. Your dashboards compare shoppers who used the size help with those who did not. The widget sends its own
events; you send two: cart and transaction_end.
On Shopify
On Shopify only the pixel sends add to cart and orders. Turn on "Track carts and orders" in the FitMyType app
(see the Shopify app guide), or, without the app, paste the
custom pixel. Do not also add the tag's cart or
transaction_end calls to your theme: each order would then arrive twice.
Other sites: the tracking tag
Add the tracking tag to the <head> of every page first. Then add the
two calls below. Each one starts with the same two lines, so it works even when it runs before the tag has
loaded.
Add to cart
Call this when a product is added to the cart, with the same product reference as in your catalogue and the size the shopper chose.
<script>
window.fmtdataLayer = window.fmtdataLayer || [];
window.fmttag = window.fmttag || function () { window.fmtdataLayer.push(arguments); };
fmttag('event', 'cart', {
product_id: 'JACKET-01', // the same reference as in your catalogue
size: 'M',
quantity: 1,
price: 59.9,
currency: 'EUR',
});
</script>
Order
Call this once on the order confirmation page. total_price and each price are numbers,
not text: write 64.9, not '64.9'.
<script>
window.fmtdataLayer = window.fmtdataLayer || [];
window.fmttag = window.fmttag || function () { window.fmtdataLayer.push(arguments); };
fmttag('event', 'transaction_end', {
order_id: 'ORDER-1001',
products: [
{ id: 'JACKET-01', size: 'M', quantity: 1, price: 59.9, currency: 'EUR' },
],
total_price: 64.9, // a number, never a quoted string
currency: 'EUR',
});
</script>
Returns
You do not send returns from the page. FitMyType reads them from your store with your orders (see Step 1: Feeds).
Consent
Events are sent only after the shopper accepts analytics. On Shopify the tag and the pixel read Shopify's own consent. An event made before consent is dropped, never sent later.
Every field of each event is in Tag events. Next: Step 4: Verify.