Vercel v0
Add DataSaaS analytics to a project built with v0 by Vercel. Since v0 generates React and Next.js code, the recommended approach uses the Next.js Script component.
Get your website ID and domain
Log in to your DataSaaS dashboard and go to your website settings. Copy your Website ID (starts with ds_) and your domain.
Send the installation prompt
In v0's chat, paste the following prompt. Replace the placeholder values with your actual credentials:
Add DataSaaS analytics to this project using the Next.js Script component.
In the root layout (app/layout.tsx), add this import and component:
import Script from 'next/script'
Then inside the <head> or at the top of <body>, add:
<Script
defer
data-website-id="ds_YOUR_WEBSITE_ID"
data-domain="yourdomain.com"
src="https://datasaas.co/js/script.min.js"
strategy="afterInteractive"
/>
Replace ds_YOUR_WEBSITE_ID with my actual website ID and yourdomain.com with my domain.
This script tracks page views and SPA navigation automatically — no additional router setup needed.Deploy to Vercel and verify
After v0 applies the changes, deploy your project to Vercel. Once live, visit your site and check your DataSaaS dashboard to confirm events are being received.
v0 generates Next.js App Router code by default. The Script component from next/script is the recommended way to load third-party scripts in Next.js, as it optimizes loading without blocking page render.
Troubleshooting
If events aren't showing up, send this follow-up prompt in v0:
Can you verify the DataSaaS analytics setup?
1. Is the Script component imported from 'next/script'?
2. Is it placed in the root layout (app/layout.tsx)?
3. Does it use strategy="afterInteractive"?
4. Show me the full layout file.Common issues
- Script in a page instead of layout— The Script component must be in
app/layout.tsx(root layout) so it loads on every page. If v0 placed it in a specific page file, ask it to move it to the layout. - Missing strategy prop — Without
strategy="afterInteractive", the script may not load correctly in Next.js. - Wrong domain after deployment— If you deployed to a
.vercel.appsubdomain, updatedata-domainto match, or add your custom domain first.
DataSaaS works seamlessly with Vercel's deployment platform. The tracking script is lightweight and loads asynchronously, so it won't impact your Vercel performance scores.