Skip to content
Frameworks

Nuxt analytics with Reveata

2 min read · Updated · By the Reveata team

Short answerAdd the Reveata script to app.head in your Nuxt config, either as a plain script entry or built with the @reveata/next/snippet helper, which has no React or Next dependency. Route changes are tracked by the script, and goals use window.reveata or trackGoal.

Nuxt renders on the server and navigates in the browser. Reveata's script handles both without a Nuxt module: you add it once to the document head through Nuxt's own configuration.

What you get

  • Every page view, the first server-rendered one and each client-side route change after it.
  • Goals from window.reveata('goal', 'signup'), or trackGoal from @reveata/next/client.
  • Revenue attribution by passing the visitor id to the server route that creates your checkout.
  • The same options as any install: cookieless mode, extra domains, excluded paths, hash routes and a custom endpoint (install the script).

Two ways to install

A plain script entry in app.head, no package needed:

ts
// nuxt.config.ts
export default defineNuxtConfig({
  app: {
    head: {
      script: [
        { src: 'https://reveata.com/js/script.js', defer: true, 'data-website-id': 'ws_your_tracking_id' },
      ],
    },
  },
});

The snippet helper: nuxtHead({ websiteId, host }) from @reveata/next/snippet builds the same entry from options. Despite the package name, the snippet export has no React or Next dependency, so it is safe in a Nuxt config. Nuxt's head configuration is documented in the Nuxt docs (opens in a new tab).

Linking payments to visits

Connect your payment provider in Reveata, then send window.reveata.metadata() from the page to the server route that creates the checkout, and copy the two ids into the checkout metadata. For Stripe that is metadata.reveata_visitor_id and metadata.reveata_session_id (Stripe Checkout attribution); the other providers take the same keys in their own custom data (connect a payment provider).

Your server route can also read the ids from Reveata's first-party cookies, _dt_v and _dt_s, keeping the part before the first dot. That works when the checkout starts from a plain form.

Frequently asked questions

Is there a Nuxt module?

No module is needed. One app.head entry loads the script on every page, and the script follows Vue Router's navigation itself.

My app uses hash routes. What changes?

Add 'data-hash': 'true' to the script entry, so /#/route changes count as pages (hash routes).

Does it work for a plain Vue app too?

Yes, with a different file: see Vue.js analytics.

See it with your own numbersReveata ties every visit and sale to the source that brought it. Add your website in a minute.
Get started
Was this page useful?
IntegrationVue.js analytics with Vue Router supportPaste the Reveata snippet before the closing head tag of your Vue app's index.html. With createWebHistory every route change is a pageview automatically; with createWebHashHistory add data-hash="true". Goals and checkout ids come from your script setup blocks.IntegrationAngular analytics with ReveataPaste the Reveata snippet before the closing head tag of src/index.html. ng build keeps it in the built page, server-side rendering included, and the Angular Router's History API navigation is counted automatically. HashLocationStrategy needs data-hash="true".IntegrationAstro analytics with revenue attributionPaste the Reveata snippet with is:inline into the Astro layout that renders the head of every page. Astro then leaves the tag as written, view transitions are tracked, and payment links or checkouts started from your pages are credited to the visit behind them.IntegrationDjango analytics with revenue attributionPaste the Reveata snippet before the closing head tag of the base template your Django templates extend. Every page is tracked, the Django admin is not, and two hidden form fields let your checkout view put the visitor id into the payment's metadata.IntegrationDocusaurus analytics for documentation sitesAdd the Reveata script to the scripts array in docusaurus.config.js, or build the entry with @reveata/next/snippet. Page changes inside the docs are tracked by the script, so every page a reader opens is counted.IntegrationExpress.js analytics with a first-party proxyPaste the Reveata snippet into the layout, static HTML or front-end index.html your Express app serves. Two Express routes can serve the script from your own domain with your proxy secret, and your checkout route can copy the visitor id into the checkout metadata.