Docs › Understand visitors
Events and revenue
Events are things your website reports to Kolvantage: a sign-up, a purchase with its amount, a download, a first deposit. You define each event in the dashboard, then your developer adds one line of code where it happens, on the page or on your server.
Events show in the Events tab with how many times they fired and the total amount. You can also use them as A/B test goals (with revenue per variation), as funnel steps, in paths, and in marketing journeys.
What you see
Every website has a built-in event called Clicks, at the top of the list: the visits the base script already counts, so there is nothing to install. It can't be changed or deleted, and it can be used to pay affiliates (see Commission groups in the affiliates guide).
Open a website and go to the Events tab. It lists the website's events, with their numbers for the date range at the top of the website page:
| Column | What it shows |
|---|---|
| Event | The name, and when it is fired (if you wrote it). |
| Code name | The name used in the code, e.g. purchase. |
| Sent from | Website code (the browser) or Server (API). |
| Amount | The currency, if the event comes with an amount, or No. |
| Fired | How many times it was fired. |
| Visitors | How many different visitors fired it. |
| Total amount | The sum of the amounts, per currency (for example $1,200 · €300). |
| Average | The average amount, per currency. |
| Last fired | When it was last fired, or Never. |
On each row:
- Code: the code for your developer, whether the event arrives, and its latest firings.
- Edit: change the event (if you can manage it).
- Recordings: the recordings of visits in which the event fired.
Click a row to open Code.
Create an event
Click + New event and fill in:
- Name: what you call it, e.g. Purchase (up to 80 characters).
- Code name: the name used in the code, e.g.
purchase. It is filled in from the name as you type. Letters, numbers and_ . : -, no spaces, up to 40 characters. It can't be changed later, because your website's code uses it. - Sent from:
- The website’s code (browser): JavaScript on the page, e.g. on the "thank you" page. Easiest to add.
- Your server (API): your server sends it when it confirms it, e.g. a payment. It can't be blocked or faked in the browser. Only events sent this way can earn affiliate commissions: an event from a visitor's browser is recorded, but never pays an affiliate (a browser can send any amount).
- When is it fired? (optional): a short note for your team, e.g. when an order is completed (up to 300 characters).
- It comes with an amount: tick this for events with a value, like a sale. Then choose the Currency (USD by default).
Click Create event. Kolvantage then shows the code to add. Copy instructions for your developer copies a ready-to-send message with the code.
When you edit an event you can change everything except the code name.
Delete event (in the event's Edit window) deletes the event and its history: every time it was received, so it disappears from the Events tab, funnels and visitor profiles. This can't be undone. If your website keeps sending it, it isn't counted until you create an event with the same code name again.
Send events from your website
For an event sent from the website's code, add this where it happens:
window._shq = window._shq || [];
_shq.push(['event', 'signup']);With an amount:
window._shq = window._shq || [];
_shq.push(['event', 'purchase', { value: 49.90 }]);This form works even if your code runs before the Kolvantage script has loaded. Once the script has loaded, Kolvantage.event() does the same:
Kolvantage.event('signup');
Kolvantage.event('purchase', { value: 49.90 });
Kolvantage.event('purchase', { value: 49.90, currency: 'EUR' });valueis the amount, as a number. Text with a number in it is understood too, in either style:"$1,299.50","1.299,50 €"and"12,50"are 1299.50, 1299.50 and 12.50. Amounts are rounded to cents.currencyis optional. Without it, the event's currency is used. It must be one of the currencies listed below.- The Kolvantage script must be on the page. See Install.
Kolvantage.goal('name'), from earlier versions, still works: it fires the event without an amount.
The full page API is in JavaScript API.
Send events from your server
For an event set to Your server (API), your server sends one request to Kolvantage with the website's secret key. Create the key in Settings → API. The Code button on a server event shows a ready-to-use example with your event's code name.
curl -X POST https://app.kolvantage.com/api/v1/events \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "event": "ftd", "visitor": "KV_VID_COOKIE", "value": 150.00, "order_id": "payment-123", "user_id": "user-45" }'visitor: the visitor's id. The Kolvantage script keeps it in thekv_vidcookie on your domain, so your server can read it from the customer's request. It links the event to the visitor: A/B tests, their latest recording, their profile. Without it, the event is counted in the Events tab only.order_id: optional, your own id for this event (e.g. the order or payment id). If it is sent twice, it counts once, unless the event allows repeats: in the event's settings (events sent from your server) turn on Allow the same order_id more than once, for events that repeat for one order, like several partial refunds. It is shown with the event (the event's latest list, the visitor's profile) and in Affiliates → Transactions.user_id: optional, your own id for the person (e.g. their id in your system). It is shown in the same places. You can send both, one of them or none. (idis the old name oforder_idand still works.)
All the fields, answers and errors are in Server API.
How it works
When an event is counted
- An event is counted only if it is defined in the Events tab. Events with an unknown code name are ignored, except that they can still count as a goal for an A/B test that uses them.
- An event set to Your server (API) is refused when it comes from a browser, so nobody can fake it from a page. An event set to Website code is refused from the API.
- Browser events are counted on every visit, recorded or not. They are not counted from IP addresses excluded in Settings → Recordings, while recording is paused, from pages outside the website's domain, for visitors who opted out, or (when Respect "Do Not Track" is on) for visitors whose browser asks not to be tracked.
- Events fired before the script has finished loading wait and are sent as soon as it is ready (up to 50 per page). If the visit isn't tracked (for example the visitor opted out, recording is paused, or Kolvantage can't be reached), they aren't sent, and the browser console shows a
[Kolvantage]warning saying why. - Each event is linked to the visitor, the visit and the page where it happened. A server event with a
visitoris linked to that visitor's latest visit.
Amounts and currency
- If the event is set to come with an amount, each firing keeps its amount and currency. If it isn't, any amount sent is ignored.
- Total amount and Average don't convert currencies. Amounts in different currencies are never added together: each currency gets its own total and average, shown side by side (for example
$1,200 · €300).
Currencies you can use: USD, EUR, GBP, ILS, CAD, AUD, JPY, CHF, SEK, NOK, DKK, PLN, BRL, MXN, INR, ZAR.
Recordings and visitors
When an event fires on a visit, the visit's recording is tagged event:<code name>, with the amount as its value (or yes without an amount). That is how Recordings finds them, and you can search for the tag in Session recordings.
Code shows the latest firings of an event: when, the page, the amount, ▶ Watch for the recording and Visitor → for the visitor profile.
Events as goals
- A/B tests: choose An event (from the Events tab) as a test goal. A visitor counts as a conversion when they fire the event after seeing the test. For events with an amount, the report also shows Revenue and Revenue per visitor for each variation. See A/B tests.
- Funnels: use an event as a step. See Funnels.
- Paths: see the pages visitors viewed before an event. See Paths.
Kolvantage doesn't fire any events by itself: all events are the ones you define and send.
Limits
- Name: up to 80 characters. Code name: up to 40 characters. Description: up to 300 characters.
- Up to 50 events waiting per page while the script loads.
- Amounts are rounded to cents.
Who can use it
- You need the Events tool (set per user in Users).
- Everyone who can see the website can see the events and their code.
- Creating and editing events needs the Owner, Admin or Manager role.
- The secret key in Settings → API is for the Owner and Admin roles.
- Recordings and ▶ Watch need the Recordings tool.