Appearance
Analytics
If your page has a dataLayer (Google Tag Manager, GA4 and others use one), the script pushes each step of the try-on to it. You need no code: build your tags and triggers on the event names below.
If your page has no dataLayer, nothing happens. The script never makes one, loads no tag, and sends nothing to an analytics service itself.
What is pushed
One entry per step:
js
{
event: 'labbesne_opened',
labbesne: {
productId: 'LO-1',
variantId: 'M',
productTitle: 'Linen overshirt',
code: undefined
}
}| Event | When |
|---|---|
labbesne_button_viewed | The script's button was put on the page. Once per page load. |
labbesne_opened | The shopper opened the try-on. |
labbesne_photo_added | The shopper has a photo the try-on accepted. |
labbesne_result_shown | A try-on picture is on screen. |
labbesne_added_to_bag | Your addToBag handler said it worked. |
labbesne_checkout_started | Your checkout handler said it worked, or the shopper was sent to checkoutUrl. |
labbesne_error_shown | The try-on could not start, or the product's picture is on a host your store doesn't allow. code says which. |
labbesne_closed | The shopper closed the try-on. |
The fields
| Field | What it is |
|---|---|
productId | The product's id, as your page gave it |
variantId | The product's variantId, as your page gave it |
productTitle | The product's title |
code | Only on labbesne_error_shown: one of the codes your page receives |
Every entry has all four keys. A key with nothing to say is undefined, not left out, so a value from one entry never sticks to the next in your tag manager.
What to know when you read the numbers
- Once per open. Each event is pushed once between an open and its close. A shopper who retakes their photo is one
labbesne_photo_added. labbesne_button_viewedis once per page load, and only for the script's own button. With a button of your own it is not pushed.- Nothing about the shopper. No id, no time, nothing from the photo or the result. Only the event's name, the product as your page gave it, and an error code.
- Problems inside the try-on are not pushed, but for one. A photo that was refused or a picture that failed is shown to the shopper inside the try-on.
labbesne_error_showncovers a try-on that could not start, and one code from inside it:garment_host_not_allowed, which your store's settings cause. See Errors. - Consent is yours. What your tags do with an entry, and under which consent, is decided by your tag manager's setup. The script only adds entries to the list.
Turn it off
On the tag:
html
<script
async
src="https://app.labbesne.com/sdk/v1.js"
data-key="pk_your_store_key"
data-datalayer="false"
></script>Or in code: Labbesne.push(['init', { dataLayer: false }]).
The same numbers in the dashboard
The dashboard's Usage page shows Labbesne's own count of the same steps, for each store. It is counted without a cookie and keeps nothing about a shopper. The dashboard's Help page says how exact each figure is.
The two will not match to the last digit: your tag manager and Labbesne count in different places, and browsers block each of them differently.
Your own events
For anything the dataLayer entries don't cover, listen to the events and send what you need yourself:
js
Labbesne.push([
'on',
'step',
({ step }) => {
window.dataLayer?.push({ event: 'try_on_step', step })
},
])