Conversion events
A conversion event is the reward signal the optimizer learns from. Create one in the app, paste its snippet where the conversion happens, and watch it verify.
A conversion event is what the optimizer is optimizing for. It is the reward signal: every variant's performance is measured by how often visitors who saw it went on to fire your event.
Get this wrong and everything downstream is wrong. The bandit will faithfully optimize toward whatever you told it to count.
Create the event first, paste the code second
Unlike 1.0, events are declared in the app before they exist in your code. Go to Settings → Events and create one.
| Field | What it means |
|---|---|
| Name | The identifier you will pass to track. Lowercase with underscores is the convention: purchase, lead_submitted, demo_booked. |
| Primary / secondary | Primary is the outcome you actually want, and it is what the optimizer learns from. Secondary events are measured and reported but do not steer traffic allocation. |
Paste its snippet where the conversion happens
Once the event exists, Optimeleon generates its snippet. Copy it from the event and put it on the code path that runs when the conversion actually occurs: your order confirmation handler, your form success callback, your booking confirmation.
Directly in your page
<script>
window.optimeleon && window.optimeleon('track', 'lead_submitted', {});
</script>Through Google Tag Manager
Create a Custom HTML tag with the same call and attach your existing conversion trigger to it: the click, form-submit or custom-event trigger you already fire on.
<script>
window.optimeleon && window.optimeleon('track', 'lead_submitted', {});
</script>window.optimeleon && guard is there on purpose: it makes the call a safe no-op on a page where the install snippet is absent, instead of a ReferenceError in your conversion handler. Keep it. Firing the same event more than once is also safe.Sending properties
The third argument is a plain object. Revenue events are the common case:
window.optimeleon('track', 'purchase', {
value: 149.00,
currency: 'EUR',
});Timing: calls before the script loads are safe
The inline bootstrap installs a queue, so a track call that runs before the tracking bundle has finished loading is queued and replayed in order rather than lost. You do not need to wrap it in a readiness check.
Shopify: pick your events, do not write them
On Shopify there is no event code to paste at all. Once the Custom Pixel is live it listens to your store's own events (purchases, started checkouts, payment submissions, adds to cart, browse and search activity) and the Events page lists what your store is actually sending, with how many times each was seen recently. Click one to make it a conversion goal. See Shopify.
Verify it fires
- Load your site and accept your cookie banner, because nothing is recorded without consent.
- Complete the conversion yourself, or trigger the code path that fires it.
- Watch DevTools → Network for a
POST https://edge.optimeleon.com/e/…returning 202, or open the preview overlay with?opti_debug=1and watch the event appear in its live feed. - Back in Optimeleon, the event row shows it was seen and the conversion step of the checklist turns green.
?opti_debug=1 is an inspection overlay, not a mute. The page tracks exactly as it would for a real visitor, which is what makes it useful for confirming an event fires. If you want to look at a variant without recording anything, use a Preview link instead.When to create an event
- Before you publish your first variant. Without a conversion event the bandit has no reward signal and cannot learn.
- One primary per page you optimize. Different pages can and should have different primaries. A pricing page and a blog post are not chasing the same outcome.
- Secondaries generously. They cost nothing, they do not steer anything, and they make your Performance view far more informative when a result surprises you.
