Docs

Custom events

Count your own actions, like newsletter sign-ups or quiz completions, per test version.

ab.one tracks orders, add-to-carts and page views on its own. Custom events let you count anything else per version: a newsletter sign-up, a filled-in contact form, a finished product quiz, a click on a size guide. They're useful as a second signal next to your goal, for example "the variant sells the same but gets twice the sign-ups".

Custom events don't decide the winner. The goal does.

1. Define the event

  1. Open the test's settings

    On the test's page, go to the Settings tab and find Custom events.

  2. Add an event

    Click New custom event. Under Event name, enter a short name, for example newsletter_signup.

  3. Allow extra details (optional)

    Under Allowed body parameters, list the extra fields ab.one should keep with each event, for example source. Anything else you send is ignored, so no personal data ends up in ab.one by accident.

2. Send the event

Whoever looks after your store's code sends a POST request when the action happens. The Custom events section shows the address and your store's public key, and a ready-made example:

curl -X POST https://app.ab.one/api/v1/events \
  -H "Content-Type: application/json" \
  -d '{
    "key": "pk_live_…",
    "test": "TEST_ID",
    "event": "newsletter_signup",
    "variant": "b",
    "visitorId": "VISITOR_ID",
    "properties": { "source": "footer" }
  }'
FieldRequiredWhat to send
keyyesYour store's public key, from the Custom events section. It's meant to be public and can only send events.
testyesThe test's ID.
eventyesThe event name you defined.
variantnoWhich version the visitor saw: control, b, c …
visitorIdnoThe ab.one visitor ID, so the event shows up in that visitor's timeline.
propertiesnoExtra details. Only the allowed body parameters are kept.

ab.one answers with status 202 when it accepted the event.

3. See the results

The test's Custom events tab shows the total for each event, by variant, by device, by country and over time.

If you haven't defined an event yet, the tab says "No custom events defined" and links to the settings.

More detail for developers: Custom events API.