Install the Revnu Tag
One script tag that tells Revnu where your visitors come from, including ChatGPT, Perplexity and other AI assistants, search engines and ads. Where to find your site key, how to keep the server key out of the browser, how it sits beside your existing pixels, and how to check it's live.
The Revnu Tag is a small first-party script for your site. On every visit it records where the visitor came from: an AI assistant (ChatGPT, Perplexity, Claude, Gemini, Copilot, Grok), a search engine, an ad click, another site, or a direct visit. Pair it with the Event API to tie trial starts (free sign-ups count here), booked calls and purchases back to that source.
You get the tag in Ads → Revnu Tag. Setup there can install it for you: Revnu opens a pull request on your GitHub repo, or gives you a prompt for your coding agent. To choose which results count, see set up outcomes.
Tip
Next.js on Vercel, in short. Add the <Script> tag below to your root layout. The site key (rk_...) is public, so it can sit in the tag or in a NEXT_PUBLIC_ environment variable. The server event key (rsk_live_...) is secret: put it in Vercel's environment variables as REVNU_EVENT_KEY, never with a NEXT_PUBLIC_ prefix, then redeploy.
Where do I get my site key?
In the dashboard, open Ads → Revnu Tag.
Enter your website and confirm what your ads should chase. Revnu creates your site.
The fastest route: choose Revnu Adds It for You to get a pull request on your GitHub repo, or Paste a Prompt Yourself and paste the prompt into the coding agent you use on your site. Either installs the tag and the server side.
To install by hand instead, click the gear to open Install Details and Keys. Your site key (it starts with
rk_) is there, with a Snippet button that shows the full tag.
Install the tag once, on every page.
The tag
<script async src="https://revnu.com/v1.js" data-site="rk_..."></script>Two keys: which one goes in an environment variable?
| Key | Starts with | Where it goes |
|---|---|---|
| Site key | rk_ |
Public. Paste it in the tag; a NEXT_PUBLIC_ variable also works. |
| Server event key | rsk_live_ |
Secret. Only on your server, as the environment variable REVNU_EVENT_KEY. Never in browser code. |
Keep the server event key out of anything the browser loads, including front-end environment variables your framework ships to the browser (for example names starting with NEXT_PUBLIC_ on Next.js). Add REVNU_EVENT_KEY to your host's server environment variables, such as Vercel's project settings, then redeploy so the server picks it up.
Install Details and Keys is where you copy the server key, or replace it with Regenerate Server Event Key. Your site key and installed tag keep working, and the only thing to update is wherever your server reads the key.
Plain HTML
Paste the line into the <head> of your shared layout or template. Site builders work the same way:
WordPress: your theme's header, or a header-scripts plugin.
Webflow: Project Settings → Custom Code → Head Code.
Framer: Site Settings → Custom Code → Start of
<head>.Wix: Settings → Custom Code → Add Custom Code. Paste it, choose All pages and Head, then apply.
Squarespace: Settings → Advanced → Code Injection → Header, then save.
Shopify: Online Store → Themes → … → Edit code →
layout/theme.liquid. Paste it just before</head>, then save.
If your site sets a Content-Security-Policy, allow revnu.com in script-src and connect-src.
Google Tag Manager
Tags → New → Custom HTML, and paste the line.
Set the trigger to All Pages.
Save, then Submit to publish the container.
Use Tag Manager or a hard-coded tag, not both.
Next.js and Vercel
Add it to your root layout with next/script:
// app/layout.tsx
import Script from "next/script";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
{children}
<Script src="https://revnu.com/v1.js" data-site="rk_..." strategy="afterInteractive" />
</body>
</html>
);
}On the Pages Router, put the same <Script> in pages/_app.tsx. Vercel needs nothing extra for the tag: it runs in the browser, so it works on any host.
Do I need the tag for ads I already run?
Not for those ads. Revnu reports an outcome to an ad platform when it traces back to a campaign Revnu runs, and your own pixel keeps reporting for the campaigns you run yourself. Install the tag when you want Revnu to run or judge its own campaigns, or to see visits from AI answers and search.
Does the Revnu Tag replace my existing pixels?
No. Keep them: the Revnu Tag runs alongside your pixels and leaves them untouched.
The tag sees visits from every source, including AI answers and every ad channel, and ties them to the outcomes your server confirms.
Revnu then reports each confirmed outcome from its own servers to every ad platform you've connected. Nothing extra loads in the visitor's browser for that.
On Google, Revnu reports to its own conversion actions, set as secondary, so your existing conversion actions and campaigns carry on as before.
On TikTok, Revnu reports to the account's Pixel, or creates one named "Revnu" when the account has none, so you don't add a second TikTok pixel to your site. If the account already has several Pixels, Revnu asks which one to use.
On X and Reddit, Revnu reports to the Pixel already on your ad account.
How do I avoid double counting?
Inside Revnu, each outcome counts once. Your server sends a stable
event_idfor each one, and sending the same id again is reported as a duplicate, not counted twice. See Event API.Judge Revnu's campaigns on Revnu's numbers. Ads → Analytics shows Revnu-confirmed results, counted once each.
On X, Reddit and TikTok, Revnu reports to the same Pixel your site or your own server events may already send to. If yours already sends the same purchase event to that Pixel, the platform's own report may show it twice for clicks on Revnu's campaigns. Compare Revnu's campaigns on Revnu's numbers rather than the platform's conversion column.
Campaigns you run yourself stay exactly as they were. Their results keep flowing through your own pixel.
How do I check it's live?
In the dashboard: during setup, Check It Works ticks off "loaded the Revnu Tag" once your site loads it, and "Your server sent a test event", then reads You're Live. The tag verifies itself the first time it loads on your own site, so open your website once after installing; reloading the dashboard doesn't count.
After setup, Ads → Revnu Tag shows a Website Activity step whenever the tag needs attention: "Install the Revnu Tag so ad visits can be recognised." if it has never reported, or Stale if it has gone quiet, with an Install Revnu Tag button.
If the tag is on your site but waiting for consent that never comes, the row reads Waiting for Consent. See Consent.
In the browser:
Open your site with a test source:
https://yoursite.com/?utm_source=chatgpt.In the browser console, run
revnu.getContext(). You should see your site key, ananonymousIdstarting withra_, andattribution.trafficClassset to"ai_referral".In the Network tab, filter for
collect. You should see two requests torevnu.com/api/measurement/collect:tag_loadedandpage_seen.
Consent
By default the tag starts as soon as it loads. If your site asks visitors for consent first, add data-consent="pending" and pass on the answer from your consent manager once the tag has loaded:
window.revnu?.consent("granted"); // or "denied"While consent is pending or denied, the tag sets no cookies and sends nothing. If your cookie banner never calls consent("granted"), the tag never sends a visit, and Ads → Revnu Tag reads Waiting for Consent. If nothing calls consent() at all, the browser console also shows a warning after about 10 seconds.
Frequently Asked Questions
Is the Revnu Tag just an environment variable I add to Vercel?
It's a script on every page plus one server variable. The public site key sits inside the script, or in a NEXT_PUBLIC_ variable if you prefer. The one variable you must add is the secret server event key, REVNU_EVENT_KEY, in your server environment variables, followed by a redeploy.
Do I still need the Revnu Tag if I already have TikTok or Meta pixels?
Yes, if you want Revnu to run or judge ads, or to see AI and search traffic. Your pixels keep working. The tag ties visits from every source to your confirmed outcomes, and Revnu reports outcomes from its own campaigns to each connected platform from its servers.
Do I need the tag for ad campaigns I already run myself?
No. Revnu reports the outcomes that trace back to campaigns it runs, and your own campaigns keep relying on your own pixel.
Will the Revnu Tag double count my TikTok conversions?
Not in Revnu: each outcome counts once there. TikTok's own report can show a result twice if your setup and Revnu both send the same event to the same Pixel, so judge Revnu's campaigns on Revnu Conversions.
Where do I find my Revnu site key?
In Ads, Revnu Tag. Start setup on an outcome and enter your site, then open Install Details and Keys. The site key starts with rk_.
Does the Revnu Tag see AI crawlers like GPTBot?
The tag counts the people who click through to your site from an AI assistant's answer, which is the traffic that can turn into customers. Crawlers such as GPTBot don't run JavaScript, so they never show up as visits.
How does it know a visit came from ChatGPT?
From the page that sent the visitor (chatgpt.com, perplexity.ai, claude.ai, gemini.google.com, copilot.microsoft.com, grok.com) or from a utm_source such as chatgpt or perplexity. Search engines and ad clicks are recognised the same way, from the referrer, UTM tags and ad click ids.
What does it store?
Two first-party cookies, each mirrored in local storage: revnu_aid, a random visitor id (the cookie is renewed for a year on each visit; the local-storage copy doesn't expire), and revnu_attr, where the visit came from, kept for the attribution window (30 days by default). A session id lives in session storage. Page URLs are stored without their query string; only UTM tags and ad click ids are kept from it. The tag never reads form fields, names or email addresses.
Will it slow my site down?
No. It's about 20 KB, loads with async so it never blocks rendering, and sends two small requests per page.
Does it count page views in a single-page app?
Yes. When a React, Next.js or Vue app changes the page without a full reload, the tag counts a page view when the path changes. Changes to only the query string or the hash don't count as a new page view.
Do ad blockers stop the tag?
Common blocklists don't block the requests the tag sends to Revnu. If the tag can't find its own site key, for example because a loader rewrote the script, it says so once in the browser console with the install line to use.