Debugging
Check events before they count
Before you trust a number, check that the events behind it look right. Viakite gives you three tools for that: debug mode in the browser, the event list on the Install page, and Realtime. This page also covers tracking on localhost and leaving your own visits out.
Debug mode in the browser
Add data-debug to the script tag, or debug to init() or the component:
1<script defer src="https://us.api.vk.viabio.me/v1/a.js" data-project="pk_live_us_…" data-debug></script>
1<Analytics project="pk_live_us_…" debug />
1init({ project: "pk_live_us_…", debug: true });
Then open the browser console and reload. Each page view, event and engagement is logged as a [viakite] send line with everything it would send, and nothing is sent. Problems are logged too:
| Console line | Means |
|---|---|
[viakite] bad key: … | The key is missing or isn't a public key (pk_live_… or pk_test_…). Tracking is off |
[viakite] off: localhost | The site is on localhost, 127.0.0.1 or file://; outside debug mode nothing would be sent |
[viakite] off: viakite_ignore | Your own visits are excluded in this browser |
[viakite] off: webdriver | The browser is automated; nothing would be sent |
[viakite] no event name | track was called without a name |
[viakite] name cut to 120 | A value was over a limit and was cut |
[viakite] plan: dropped | A property broke a rule (an object, a list, a bad name) and was left out |
[viakite] user id looks personal; dropped | identify got an e-mail address or a phone number |
[viakite] init twice | init or <Analytics /> ran a second time; the second does nothing |
Debug mode sends nothing, so turn it off before you ship. Outside debug mode the SDK is silent and never throws.
Track on localhost
Nothing is sent from localhost, 127.0.0.1, *.localhost or file://, so your development doesn't count as traffic. To send events from your machine, add data-localhost (or the localhost prop):
1<script defer src="https://us.api.vk.viabio.me/v1/a.js" data-project="pk_test_us_…" data-localhost></script>
Use a test key (pk_test_…) on your machine so your clicks stay out of your reports. Test events are left out of every report, but they show in the event list on the Install page, marked test, so you can watch them arrive.
If your project has allowed hostnames, localhost must be on the list, or its events are dropped.
The event list on the Install page
Open Analytics → Install. At the top, the install check says Waiting for the first event… until your project's first event arrives, then Events are arriving.
Below, Last events shows the newest events of the last 24 hours, checked every 5 seconds:
| Column | What |
|---|---|
| Time | How long ago it arrived |
| Event | Page view, Engagement, or the event's name. test next to it means it was sent with a test key |
| Page | The page it was sent from |
| Browser | Browser and operating system |
| Warnings | OK, or what the server cut or dropped, such as a value cut to 255 characters or a user id dropped as personal |
It shows the latest 10 of up to 100 events. The same list, with every property, is in the API:
GET/v1/projects/{project}/analytics/debuggerEvents sent with a test key are in the list too, with "test": true in the API. No report counts them.
Test keys and test data
Events sent with a test key (pk_test_…) are test data: no report, Realtime screen or bill counts them. The Test data card on the Install page shows how many your organization stored this month, across its projects, out of the 100,000 a month that are free. Past that, test events are dropped until the first of next month (UTC); live events are never affected. Test events are kept 7 days.
Turn on Only test events in that card to see only them in Last events. The same count is in the API:
GET/v1/projects/{project}/test-eventsNot shown yet
The server doesn't warn about a value of the wrong type (a price sent as text) yet; it only reports values it cut or dropped.
Exclude your own visits
To stop counting your own browser on your live site, open Analytics settings → Tracking in the dashboard. Under Your own visits, check the address of your site and click Stop counting this browser. Your site opens in a new tab with ?viakite_ignore=true in the address; the script remembers that in this browser and from then on sends nothing from it on this site. Count it again opens it with ?viakite_ignore=false.
You can also open the address yourself, such as https://acme.com/?viakite_ignore=true, or run this in the browser console on your site:
1localStorage.setItem("viakite_ignore", "true");
The flag is kept in your site's storage in that browser, so do it once on each browser and each domain you use. It doesn't apply in a private window, and the dashboard can't show whether it is set. To leave a whole office out, exclude its IP addresses in tracking settings.
Events don't arrive?
Go through these in order:
- Ad blocker. Try a private window with extensions off. If that works, serve Viakite through your own domain.
- The key. With
data-debug, look forbad key. Copy the snippet again from the Install page. - Localhost. Add
data-localhost, or test on your deployed site. - Hostnames. If you set allowed hostnames, events from other hostnames are dropped. The rejected ones are listed by
GET /v1/projects/{project}/rejected-hostnames. - Exclusions. Your IP address or the page's path may be excluded, or your browser may set Do Not Track while your project respects it. See Tracking settings.
- Bots. Headless and automated browsers are never counted. Test in a real browser.
- Test key. A
pk_test_key works, but its events don't show in reports. They show only in the event list on the Install page, marked test. Past 100,000 test events in a month they are dropped (see Test keys and test data).