Tag events
The tracking tag fmttag takes two commands: config once per page, and
event for each event. Events go to https://api.fitmytype.com/events. Install the tag first: see
Tracking tag.
config
Use the object form. It sets your client ID, the shop country and the sales channel.
<script>
window.fmtdataLayer = window.fmtdataLayer || [];
window.fmttag = window.fmttag || function () { window.fmtdataLayer.push(arguments); };
fmttag('config', { clientId: 625, shopCountry: 'NO', channel: 'web' });
</script>
<script async type="module" src="https://recommender.fitmytype.com/fmttag.js"></script>
| Field | Value |
|---|---|
clientId | Your client ID, a whole number. Required. |
shopCountry | The shop country as an ISO 3166-1 alpha-2 code, or WW for a worldwide shop. |
channel | A free label for the sales channel, such as web. |
debug | true writes each event to the browser console. |
The short form
The short form with the client ID alone also works. It leaves shopCountry and channel
unset, so events carry no shop country or channel, and debug stays off. Prefer the object form.
fmttag('config', '625');
Event names
You send 2 events: cart and transaction_end.
The widget sends its own events, including the product view
(product), by itself: never send them from your page.
cart
A product in a size was added to the cart.
| Field | Type | Value |
|---|---|---|
product_id | text | The product reference, as in your catalogue. Required. |
size | text | The size name, as shown on the page. Required. |
quantity | whole number | Default 1. |
price | number | The unit price. |
currency | text | ISO 4217 code, such as EUR. |
variant_id | text | Your variant id, when you have one. |
<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>
transaction_end
An order was placed. Send it once, on the order confirmation page.
| Field | Type | Value |
|---|---|---|
order_id | text | Your order number. Required. |
products | list | One line per product and size: id, size, quantity, price, currency. At least one line. |
total_price | number | The order total, as a number (64.9), never a quoted string. |
currency | text | ISO 4217 code. |
<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>
On Shopify: the pixel's names
On Shopify the pixel sends add to cart and orders, not the tag. It uses Shopify's own names: the order is sent as
checkout with its total, to /events/pixel/shopify. FitMyType stores it as
transaction_end with total_price, so your dashboards show one kind of order whichever
way it came. The tag always sends transaction_end with total_price. Do not add tag
cart or transaction_end calls on a Shopify store.
Every field
The API reference lists the intake endpoints and every event's full schema.