# JavaScript events Source: https://www.luriart.com/docs/reference/javascript-events Plain text: https://www.luriart.com/docs/reference/javascript-events.txt The window.luria API (convert and exposure), the conversions Luria detects on its own, the events the snippet sends, and what the API does not include. The snippet exposes exactly two methods. Everything else it does is automatic. ## What you'll need * Luria installed with the script tag. See [Script install](/install/script). * Access to the code of your thank-you or confirmation page. * Nothing at all on Shopify. Purchases there come from the Luria web pixel and order webhooks, and calling `convert()` yourself would count the order twice. ## `window.luria.convert(goal, value)` Records one conversion for this visitor, attributed to the variant they saw earlier in the session. It sends immediately instead of waiting for the next batch, then clears the stored attribution so a later, unrelated purchase cannot be tied back to a test that has since ended. ```js window.luria.convert("purchase", 129.00); window.luria.convert("lead"); ``` `goal` falls back to `"conversion"` if you omit it, `value` to `null`. Call it once per order. Two calls on one page count twice. ## `window.luria.exposure(test, arm)` Records that this visitor saw `arm` of `test`. Luria calls this itself every time it applies a change, so you only need it if you are serving your own variant and want Luria to measure it. On a Shopify storefront it also stamps the cart, so the order carries the attribution into checkout. ## `window.luria` may not exist yet The tag is `async`, and the API is only created once the visitor is allowed to be tracked at all. If Global Privacy Control or Do Not Track is on, or the visitor declined the consent banner, `window.luria` is never defined. That is correct behavior, not a bug, so guard your call: ```html ``` That gives up after about five seconds instead of hanging around forever. ## Conversions Luria detects on its own On non-Shopify sites only, and only on a full page load, Luria fires `convert("auto", null)` when the URL looks like an order confirmation: * the path ends in `/thank_you` or `/thank-you` (or is followed by `/`, `?` or `#`), or * the path contains `/orders/` where the token is at least 6 characters. It records the order token in the visitor's browser and fires once per token, so a reload never double counts. If you also call `convert()` on that same page, you get two conversions. Pick one. ## What the snippet sends without you `session_start` (device type, referrer, and utm\_source / utm\_medium / utm\_campaign), `pageview`, `click` (the label of the clicked link or button, first 60 characters), `form` (that a form was started, never its contents), `checkout_step` (on paths containing `checkout` or `payment`), `exposure`, and `conversion`. They are batched to Luria every 1.5 seconds and flushed when the page is hidden. ## What is not in the API * **No single-page-app hooks.** The snippet runs once per full page load and does not listen for `pushState`, `popstate` or `hashchange`. Install it on marketing and sales pages, not inside a logged-in app shell. If your confirmation screen is client-side routed, `window.luria` is still there from the initial load, so call `convert()` yourself when it renders; auto-detect will not fire. * **No other methods.** `convert` and `exposure` are the whole surface. * **No API keys, no public REST API, no outbound webhooks.** ## Verify it worked * Open the confirmation page with the Network tab open. A request to `luriart.com/api/events` should carry a `conversion` event. * The conversion appears in the dashboard's Overview counters, and the session appears in Customers. ## Common failures * **`window.luria is undefined`.** The snippet has not loaded yet, or this visitor is not trackable (GPC, Do Not Track, or consent declined). Use the guard above. * **Two conversions for one order.** Auto-detect plus your own call, or a call that runs twice on the page. See [Duplicate conversions](/troubleshooting/duplicates). * **Nothing happens on Shopify.** By design. The snippet never counts purchases there. * **The value is wrong.** Pass a number, not a formatted string. Omit it entirely for non-monetary goals. ## Next steps - [Script install](/install/script) - [Verify your install](/install/verify) - [Duplicate conversions](/troubleshooting/duplicates) - [Uninstall Luria](/reference/uninstall)