Skip to Content
Browse the Docs▾

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 yourself in Ads → Revnu Tag. To choose which results count and get a setup prompt for your coding agent, 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?

  1. In the dashboard, open Ads → Revnu Tag.

  2. Click Set Up on an outcome, choose what counts, then enter your website. Revnu creates your site.

  3. The fastest route: click Copy Setup Prompt and paste it into the coding agent you use on your site. It installs the tag and the server side for you.

  4. To install by hand instead, 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>.

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 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 only when it traces back to a campaign Revnu runs. Results from campaigns you run yourself aren't sent anywhere by Revnu, so your own pixel keeps doing that job. 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 isn't an ad platform's pixel and doesn't touch them.

  • 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_id for 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 aren't affected. Revnu doesn't send their results to any platform.

How do I check it's live?

In the dashboard: Ads → Revnu Tag shows Tag Live on your site, with the time of the last page view, once the tag reports in. When a confirmed outcome also arrives from your server, it shows Browser and Server Joined. If nothing shows, it says "No new tag activity. Confirm the tag is installed and allowed to send data."

In the browser:

  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.

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.

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 only reports outcomes that trace back to campaigns it runs, so 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.