What you get
- Logins and sign-ups, successful and failed, with the country, browser, device, how long each took and why the failed ones failed.
- Clicks on the buttons you mark.
- Active users: who is on your site now, on a map, with their name or email if you choose to collect it.
It works with apps that have a server part, such as Next.js, Remix or an Express backend with a React front end. Plain HTML sites are not supported in this first version, because sign-ins have to be reported from a server.
Set up a project
Create the project
In the dashboard choose New project, then Analytics. Give it a name and the address of your website, and choose which details of signed-in people to collect. You can link a deploy project here or skip it.Copy the keys
You get a publishable key and a secret key. The secret key is shown once; copy it into your server's environment.Install the package
Runnpm install @vantrex/analyticsin your app.Report from the browser and the server
Add the component to your layout and calltrackLoginon your server after a sign-in. The SDK guide has the code.
NEXT_PUBLIC_VANTREX_ANALYTICS_KEY=vtxa_pk_…
VANTREX_ANALYTICS_SECRET=vtxa_sk_…The two keys
| Key | Starts with | Use it | What it can do |
|---|---|---|---|
| Publishable | vtxa_pk_ | In the browser | Report that someone is on a page, and clicks. Nothing else. |
| Secret | vtxa_sk_ | On your server only | Report logins, sign-ups and who a visitor is. |
Logins and sign-ups are only accepted with the secret key, because a browser can be made to claim anything. If a secret key is ever exposed, rotate it in the project settings: a new key is created and the old one keeps working for 10 minutes so you can roll the new one out.
A publishable key only reports from your project's website address, and from localhost while you develop. Add other addresses, such as a staging site, in the project settings.
The dashboard pages
| Page | What it shows |
|---|---|
| Home | Your projects with a picture of the site and when it was last active, and four cards: logins, sign-ups, people online now, and the project with the most activity. |
| Logins and Signups | Totals, success rate, a chart over time, countries, browsers, operating systems, devices and the reasons attempts failed. Choose all projects or one, a period, and all, successful or failed. |
| Active users | A map of who is online, with a list of their name or email, page, device and when they were last seen. |
| Project settings | Rename the project, change its address, choose what to collect about people, rotate the secret key, copy the project ID, link a deploy project, export your data or delete the project. |
A person counts as online if their browser reported in during the last two minutes. People who close the tab abruptly can stay on the list for up to that long.
Linking a deploy project
You can link an analytics project to one of your deploy projects. A linked project can be filtered by deployment on the Logins and Signups pages, and its keys also appear in the deploy project's settings. Unlinked projects work the same, without the filter. The link can be added or removed at any time in the analytics project's settings.
What is stored
You choose which details of signed-in people are kept: user ID, name and email. Anything you leave off is dropped when it arrives, and without the user ID only a one-way code is kept so distinct users can still be counted. IP addresses are used to work out the country and are not stored. Raw events are kept for 90 days; the counts behind the charts are kept longer.
You can download everything stored for a project from its settings, as CSV or JSON lines, and deleting the project removes its events. Deleting your account removes all of your analytics projects.
Limits
Each account can have 20 analytics projects. Events are rate limited so one site cannot flood the service: a visitor's browser may report 60 heartbeats a minute, and a project 3 000 browser events and 6 000 server events a minute. Past a limit the service answers 429 with a Retry-After header. See the API reference.