Skip to main content
Setting up AI Traffic Analytics requires adding a small JavaScript snippet to your website. This page walks through generating the snippet, installing it, and optional proxy configuration to avoid ad blockers.

Generate Your Tracking Snippet

  1. Open your project in DevTune
  2. In the sidebar, expand AI Traffic and select Settings
  3. Click Generate Tracking Snippet
DevTune generates a unique snippet key for your project. The snippet code appears on the settings page, ready to copy.

Install the Snippet

Copy the snippet and add it to your website’s layout or template file so it loads on every page. The snippet should be placed before the closing </body> tag.

Next.js

Add the snippet to your root layout file (app/layout.tsx or pages/_document.tsx):
import Script from 'next/script';

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        {children}
        <Script
          id="devtune-tracking"
          strategy="afterInteractive"
          dangerouslySetInnerHTML={{
            __html: `PASTE_YOUR_SNIPPET_HERE`,
          }}
        />
      </body>
    </html>
  );
}

WordPress

Add the snippet to your theme’s footer.php file, or use a plugin like “Insert Headers and Footers” to add it to the footer section.

Webflow / Squarespace

Go to Site Settings then Custom Code and paste the snippet in the Footer section.

Plain HTML

Add a <script> tag before the closing </body> tag in your HTML template:
<script>
  PASTE_YOUR_SNIPPET_HERE
</script>

Enable or Disable Tracking

On the AI Traffic Settings page, use the toggle switch to enable or disable tracking at any time. When disabled, the collection endpoint rejects incoming events and no data is recorded.

Rate Limits

Each tracking snippet is rate-limited to 1,000 requests per minute. This is more than sufficient for most websites. If your site exceeds this limit, excess requests are silently dropped.

Proxy Setup (Avoid Ad Blockers)

Some ad blockers and privacy extensions block requests to third-party tracking domains. You can proxy the tracking endpoint through your own domain so the request appears first-party and is not blocked.

How It Works

Instead of the snippet sending data to devtune.ai/api/v1/llm-traffic/collect, you configure a reverse proxy so requests go to yoursite.com/dt/collect, which forwards them to DevTune.

Vercel / Next.js

Add a rewrite to next.config.ts:
// next.config.ts
async rewrites() {
  return [
    {
      source: '/dt/:path*',
      destination:
        'https://devtune.ai/api/v1/llm-traffic/:path*',
    },
  ];
}

Netlify

Add to netlify.toml:
[[redirects]]
  from = "/dt/*"
  to = "https://devtune.ai/api/v1/llm-traffic/:splat"
  status = 200
  force = true

Cloudflare

Create a redirect rule or Cloudflare Worker that proxies /dt/* to devtune.ai/api/v1/llm-traffic/*.

nginx

location /dt/ {
  proxy_pass https://devtune.ai/api/v1/llm-traffic/;
  proxy_set_header Host devtune.ai;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header X-Forwarded-Host $host;
}

Update Your Snippet

After setting up the proxy, update the beacon URL in your snippet. Replace devtune.ai/api/v1/llm-traffic/collect with your proxy path (e.g., yoursite.com/dt/collect).

Multi-Site Tracking

You can use the same tracking snippet across multiple websites or subdomains. The dashboard automatically detects distinct domains and provides a domain filter dropdown so you can view traffic for each site individually or in aggregate.

Verifying Installation

After installing the snippet:
  1. Visit your website in a browser
  2. Open the DevTune AI Traffic dashboard
  3. You should see traffic appearing within a few minutes
If no data appears, check:
  • The snippet is present in your page source (View Source in browser)
  • The snippet key matches the one shown in your AI Traffic Settings
  • Ad blockers are not blocking the request (check browser DevTools Network tab, or set up a proxy)
  • Tracking is enabled (the toggle on the Settings page is active)

Next Steps