RevnuDocs
Browse the Docs

Measurement / Install the Revnu Tag

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.

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 signups, bookings and payments back to that source.

The tag

<script async src="https://revnu.com/v1.js" data-site="rk_..."></script>

Your site key starts with rk_. Revnu gives it to you when measurement is set up for your account; ask your Revnu contact if you don't have one. Install the tag once, on every page.

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>.

Google Tag Manager

  1. Tags → New → Custom HTML, and paste the line.

  2. Set the trigger to All Pages.

  3. 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: the tag runs in the browser, so it works on any host.

Check that it works

  1. Open your site with a test source: https://yoursite.com/?utm_source=chatgpt.

  2. In the browser console, run revnu.getContext(). You should see your site key, an anonymousId starting with ra_, and attribution.trafficClass set to "ai_referral".

  3. In the Network tab, filter for collect. You should see two requests to revnu.com/api/measurement/collect: tag_loaded and page_seen.

Revnu marks the tag as verified the first time it loads.

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.

Agents: this page is also markdown at /docs/revnu-tag.md, answers Accept: text/markdown, and is listed in /docs/llms.txt.

Frequently Asked Questions

No. Crawlers do not run JavaScript. The tag sees people who click through to your site from an AI assistant's answer, which is the traffic that can turn into customers.