Goals
Count conversions on a page or an event
A goal is a page or an event that counts as a conversion: a signup, a purchase, a visit to your thank-you page. Once you name it, Viakite counts how many visitors reached it and what share of all visitors that is. A project can have up to 50 goals.
Page goals and event goals
| Kind | Counts when a visitor | Example |
|---|---|---|
| Page visit | Opens a page whose path matches | /thank-you, /docs/* |
| Custom event | Sends an event with this name | Signup, Purchase |
A page path starts with / and has no spaces. * matches any part of it: /docs/* matches /docs/install and /docs/api/keys, and /blog/*/comments matches every post's comments. Without a * the path must match exactly.
An event goal matches the event's name exactly, as you send it with track or a viakite-event-name= class. See Custom events.
Conditions on properties
An event goal can have up to 20 conditions on the event's properties, such as plan is pro. Each condition has a property, an operator (is, is_not, contains, starts_with) and a value.
A goal with conditions counts only the events whose properties meet all of them: a goal for Signup where plan is pro counts visitors who sent a Signup with plan set to pro. contains ignores case, and is_not also matches events that don't have the property.
Create a goal in the dashboard
Open Goals
Go to Analytics → Goals and click New goal. You need the
analytics.managepermission.Name it and pick what counts
Give it a name (up to 100 characters, one per name in a project). Under Counts when a visitor, pick Page visit and enter the path, or Custom event and enter the event name. Event names your site has already sent are suggested as you type.
Create it
Click Create goal. It counts your existing data too, since conversions are worked out when you look at them.
The Goals page lists every goal with what it matches, its Conversions, its Rate and, for event goals, its Revenue (the revenue of the goal's events, in your project's currency) for the date range, under a count such as "3 of 50 goals". The Visitors / Visits switch above the table picks what a conversion counts: visitors who reached the goal (the default), or visits that did, with the rate out of all visits. Use the menu on a row to edit or delete a goal. Deleting a goal removes it from reports; the events themselves stay. With Compare on, a Change column shows how each goal's conversions (or converted visits) moved against the comparison. Below the list, the Breakdown card starts with Goal: for each goal, the visitors and visits that reached it and the page views and events that did, split by any second dimension if you like, with its own Export CSV.
What brings a goal's conversions
Click a goal's name to open its report. It keeps the date range and filters you had on the Goals page, and shows:
- Conversions, Conversion rate and, for event goals, Revenue, against the comparison period, and a chart of each over time. Click a tile's number to see the visitors who reached the goal.
- Channels, Sources, Campaigns (UTM campaign with its source) and Landing pages (the first page of the visit), each with the visitors who converted (and their change, with Compare on), the conversion rate of that row's visitors, its visitors and revenue. Rows with no conversions are left out, and the most conversions come first.
- A Breakdown card with the goal's conversions, conversion rate and visitors by any one or two dimensions, starting with Channel, and its own Export CSV.
Conversions count for the source of the visit they happened in (last touch). Export CSV downloads the sources table.
Attribution: every visit that led to a conversion
The Attribution card at the bottom of a goal's report shares each conversion among all the visits that led to it, under four models side by side: First touch (all the credit to the first visit), Last touch (to the visit it happened in), Linear (the same share to each) and Position-based (40% to the first, 40% to the last, 20% shared by the ones between). Pick a model to sort the table by it and see its share of all conversions. Credit can be a fraction, such as 0.5 when a conversion had two visits.
Choose what the credit goes to (channel, source, campaign, UTM source, UTM medium or referrer), and what to count:
- Visitors · same day: the visitor's visits earlier that day, since a visitor id lasts one day.
- Signed-in users · 30 days: people your site identifies, with their visits on every device in the 30 days before they converted. Visitors who never signed in are left out.
How conversions are counted
- Conversions: visitors who reached the goal at least once in the range.
- Conversion rate: conversions divided by all visitors in the range.
Both count visitors. converted_visits and visit_conversion_rate count visits instead, as the Visits switch does. A conversion counts for the source of the visit it happened in (last touch); with "attribution": "first_touch" it counts for the visitor's first visit of the day. See Attribution. To share a conversion among every visit that led to it (linear or position-based), or to follow signed-in users across days and devices, use the attribution endpoint.
To read them from your code, ask the query endpoint for the conversions and conversion_rate measures with a goal (with its conditions, if it has any), and break them down by any dimension:
1{2"measures": ["conversions", "conversion_rate"],3"goal": { "type": "event", "value": "Signup" },4"breakdown": ["source"],5"date_range": { "preset": "30d" }6}
Manage goals with the API
Goals live on your region's data host, https://us.api.vk.viabio.me. Reading needs a secret key with analytics.view; changing needs analytics.manage.
1curl https://us.api.vk.viabio.me/v1/projects/prj_…/goals \2-H "Authorization: Bearer sk_live_us_…" \3-H "Content-Type: application/json" \4-d '{5"name": "Pro signup",6"kind": "event",7"event_name": "Signup",8"conditions": [{ "property": "plan", "operator": "is", "value": "pro" }]9}'
page or event.page: the path, starting with /, with * for any part. Up to 255 characters.event: the event's name. Up to 255 characters.event: up to 20 tests, each property, operator and value. An event counts only when it passes all of them.PATCH takes the same fields, all optional; fields left out stay as they are. The errors you may see:
| Code | Status | When |
|---|---|---|
validation_error | 422 | A field is missing or breaks a rule; details names it |
goal_limit | 422 | The project already has 50 goals |
goal_name_taken | 409 | Another goal in the project has this name |
not_found | 404 | No such goal in this project |