A Vue app built with Vite is served from one index.html, and Vue Router changes pages in the browser. Reveata needs one tag in that file and, for hash routing, one attribute.
What you get
- Every route counted as a pageview, with no router hooks.
- Goals from templates (an attribute) or from code.
- Revenue attribution by sending the visitor id with the checkout request.
- Development visits left out: the Vite server on
localhostis ignored unless you allow it.
How to install it
Open index.html next to vite.config.ts (projects made with the older Vue CLI keep it in public/index.html) and paste the snippet before </head>. Then choose by router mode:
| Vue Router mode | URLs look like | What to add |
|---|---|---|
createWebHistory() |
/settings |
Nothing |
createWebHashHistory() |
/#/settings |
data-hash="true" on the tag |
Without data-hash in hash mode, every route has the path /, so only the first page is counted. The two modes are explained in Vue Router's history mode guide (opens in a new tab). For Nuxt, see Nuxt analytics.
Goals in templates and code
In a template, add the attribute: <button data-reveata-goal="signup">. Templates can't reach window, so to send a goal from code, call the script in <script setup>:
function onSignup() {
window.reveata?.('goal', 'signup');
}Linking payments to visits
Connect your payment provider in Reveata (connect a payment provider), then send window.reveata.metadata() with the request that creates the checkout. Your server puts reveata_visitor_id and reveata_session_id into the checkout's metadata or custom data, and the payment is credited to the visit. Links to Stripe Payment Links need no code at all (Stripe Payment Links analytics).