Nuxt and Vue A/B testing
Add AB Splits to your Nuxt config or your Vue app's index.html and test any route. The snippet follows client-side navigation, so tests re-apply on every route change.
Free plan · 1,000 visitors / month · no card
Set up in 3 steps
- 01Add the script to app.head in nuxt.config.ts, or to index.html for a plain Vue app.
- 02Mark tested elements with a data attribute, like data-ab="hero-title".
- 03Create a test with selector [data-ab=hero-title] and a URL pattern for the route.
nuxt.config.ts
export default defineNuxtConfig({
app: {
head: {
script: [{ src: "https://absplits.com/s.js", "data-key": "YOUR_SITE_KEY" }],
},
},
});Your real site key is shown in the dashboard after you add your site.
What to test on Nuxt & Vue
All 56 examples →Lead with the outcome, not the product category
Say what happens next on the button
Make 'Continue with Google' the main sign-up option
Test a 7-day trial against a 14-day one
Default the pricing toggle to annual
Capture the email right in the hero
AI writes variants
Choose a headline or button and AI reads your real page to write 3–5 alternatives, each with its reasoning.
Honest stats
Chance to beat the original, 95% intervals, and a plain keep-running or stop verdict. No p-value guesswork.
Results in GA4
Every tested visitor is tagged in GA4, so any report can be split by variant.
Questions
Will Vue's hydration overwrite the variant?+
Use a stable data attribute as the selector. The snippet keeps applying changes while the page renders, so the variant holds after hydration.
Can I branch logic on the variant in code?+
Yes. Call ABSplits.variant(testId) to get the visitor's variant, and ABSplits.track("event") to record a custom conversion.
Can I see results in Google Analytics 4?+
Yes. Every visitor in a test sends an absplits_exposure event to GA4 with the test and variant name, so you can break down any GA4 report by variant. AB Splits also shows its own Bayesian results.
A/B testing on other platforms