Projects

The tracking snippet

Add one cookieless script tag to your site so Larvabot can tell which emails, threads and directories brought visitors.

2 min readUpdated

The tracking snippet is one line of JavaScript for your own site. It tells Larvabot where each visit came from, so the Reports tab can show which emails, threads and directories actually sent people your way.

It's cookieless and collects no personal data: no cookies, no IP addresses, no fingerprinting. Just the page, the referring site and any ?ref= tag.

#Get your snippet

Open the project's Setup tab and find Tracking snippet. It looks like this, with your project's own key:

html
<script defer src="https://larvabot.com/t.js" data-key="your-project-key"></script>

Click Copy, then add it once to every page of your site, just before </head>.

#Adding it to your site

#Plain HTML or most site builders

Paste it into your site-wide header or "custom code" setting (Webflow, Framer, Carrd, Ghost and Squarespace all have one).

#Next.js

Put it in your root layout with the Script component:

tsx
import Script from "next/script";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script src="https://larvabot.com/t.js" data-key="your-project-key" strategy="afterInteractive" />
      </body>
    </html>
  );
}

#WordPress

Use a header snippet plugin (such as WPCode) and paste the snippet into the site-wide header.

#Google Tag Manager

Add a Custom HTML tag with the snippet and fire it on all pages. Larvabot can't see it in your page source this way, so the status shows Not in page source once visits arrive, which is fine.

#Checking it works

Next to the snippet, the tracking status tells you what Larvabot sees. It rechecks daily, and you can check any time.

StatusMeaning
✓ Tracking activeFound on your site and visits are arriving.
✓ Snippet installedFound in your page source; no visits recorded yet. Visit your site once to wake it up.
? Not in page sourceNot in the HTML, but visits arrived (tag managers do this). Nothing to fix.
! Wrong keyA snippet is there, but with another project's key. Copy it again from this project.
✕ Not foundNot found on the pages checked, and no recent visits.
✕ Tracking stoppedIt used to work and now it's gone, usually after a site redesign. Add it back.
! Couldn't checkYour site couldn't be reached during the check.

Visits need a nudge

A fresh install shows no data until someone visits. Open your site in a private window once and the status should switch to Tracking active within a minute.

When Larvabot sends an email, links to your project get a ref tag like ?ref=e123 (the lead's ID) added automatically, so a click is attributed to that exact email. Links that already have a ref are left alone. For directories and communities, the referring site is enough. How visits are attributed

#Privacy

The snippet records the page path, the referrer, ref and utm_* tags, a country and the time. It sets no cookies and stores no IP addresses, so in most places it doesn't need a cookie banner. Check your own legal requirements, though; the larva is not a lawyer. Security and privacy

Keep going