> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trylora.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Analytics events

> Reference for Trylora merchant analytics event names, timing, and payload fields.

Trylora exposes two merchant analytics events. Names differ between the Generic Embed providers and Shopify Customer Events.

## Event names

| Result                         | Generic Embed                 | Shopify Customer Events       |
| ------------------------------ | ----------------------------- | ----------------------------- |
| Try-on image becomes ready     | `trylora_tryon_succeeded`     | `trylora:tryon_succeeded`     |
| Try-on animation becomes ready | `trylora_animation_succeeded` | `trylora:animation_succeeded` |

Use the name for the active Installation Path. Do not subscribe to both naming schemes on one Shopify Online Store theme.

## Emission contract

An event is emitted:

* When a new result transitions to ready during the current widget session
* Once for each event and result pair
* Only from storefront embed mode

An event is not emitted:

* When a result is queued, running, or failed
* For a result that was already ready when tracking initialized
* From browser extension mode

## Payload

| Field                   | Type   | Required | Description                                                 |
| ----------------------- | ------ | -------- | ----------------------------------------------------------- |
| `trylora_product_url`   | string | Yes      | Absolute URL for the source product or current product page |
| `trylora_product_title` | string | No       | Product title when Trylora can resolve one                  |

Example:

```json theme={null}
{
  "trylora_product_url": "https://shop.example.com/products/hero-dress",
  "trylora_product_title": "Hero Dress"
}
```

Trylora resolves the product URL in this order:

1. Product URL stored with the generated result
2. Canonical product URL discovered on the page
3. Current page URL

It resolves the title from generated-result metadata first, then page product metadata.

<Info>
  GA4 does not receive the customer photo, generated media, or internal Trylora job identifier.
</Info>

## Shopify App Pixel delivery

The Trylora storefront publishes the Shopify event fields on `event.customData`. The Trylora App Pixel validates them and forwards the two success events to GA4 using the underscore event names in the table above.

The Shopify event also contains `trylora_ga_measurement_id` and `trylora_source_job_id`. These transport fields select the configured GA web stream and prove that the event belongs to a completed Trylora job. Neither field is sent as a GA4 event parameter.

Shopify custom events can be published manually from a browser, so the App Pixel and backend validate field types, the store connection, and the allowlisted event name before forwarding.

## Generic provider delivery

* GA4 receives `gtag("event", eventName, payload)`.
* GTM receives `{ event: eventName, ...payload }` in `window.dataLayer`.
* Mixpanel receives `mixpanel.track(eventName, payload)`.

Provider calls occur only when merchant analytics and the specific destination are enabled, and the required page global exists.
