Skip to Content

WordPress

WordPress has two halves to install, and most sites want both:

  1. The tracking snippet records human visitors. Goes in <head>.
  2. Crawler reporting records AI crawlers like GPTBot and ClaudeBot. Runs in PHP.

The second is not optional polish. AI crawlers never execute JavaScript, so the snippet below will never record one, no matter how it is installed. Part 2 covers that half.

Part 1: the tracking snippet

There are two ways to add the snippet to WordPress. The plugin approach is easier and survives theme updates.

Install a header-scripts plugin. WPCode  (free) and “Insert Headers and Footers” are both popular choices. Then:

Install the plugin

In your WordPress admin, go to Plugins → Add New, search for “WPCode”, install it, and activate it.

Open the header code box

Go to Code Snippets → Header & Footer (WPCode) or Settings → Insert Headers and Footers, depending on which plugin you installed.

Paste the snippet

Paste the snippet into the Header box:

<script defer src="https://api.snowanalytics.app/sa.js" data-site="YOUR_SITE_ID"></script>

Save

Click Save. The snippet is now added to every page on your site.

Verify

Visit your site in a browser, then check the Live view in the Snow dashboard. See Troubleshooting if nothing appears.

Part 2: AI crawler reporting

The snippet above records people. It cannot record AI crawlers, because GPTBot, ClaudeBot, PerplexityBot and CCBot make one HTTP request, read the bytes, and leave. They never run the script, so that traffic is invisible to every snippet-based analytics tool, including this one.

WordPress runs PHP on your server, which does see those requests. So this half installs there.

You don’t need a Snow plugin. Beacon (the MIT package whose protocol Snow speaks) ships a PHP client that does the job with no theme file edited.

Create a reporting key

In the Snow dashboard, open Settings → API keys. Under What this key may do, tick AI crawlers, untick everything else, and click Create key. It is shown once, and with only that scope it carries bots:write and nothing else.

Download the PHP client

Get it from github.com/Snow-SEO/beacon  and put it somewhere outside your web root, so it can’t be requested over HTTP.

Edit wp-config.php

Add this above the /* That's all, stop editing! */ line:

wp-config.php
define( 'BEACON_KEY', 'snw_live_...' ); define( 'BEACON_ENDPOINT', 'https://api.snowanalytics.app/api/beacon/hits' ); define( 'BEACON_SITE_HOST', 'example.com' ); require_once '/path/to/beacon/beacon.php';

Verify

In Settings → Tracking → AI crawlers, the status turns green as soon as your server posts its first batch, even before any crawler visits. To force one:

curl -A "GPTBot/1.0" https://example.com/

It appears on the AI Traffic section within a minute.

Caching plugins can hide crawler traffic. If WP Rocket, W3 Total Cache, LiteSpeed Cache or a CDN serves a cached page, PHP never runs for that request and the hit is never reported. Cached pages are exactly the ones crawlers hit most. If you use a full-page cache behind Cloudflare, install the Cloudflare Worker instead: it runs ahead of the cache.

Full detail, including the four verification states: AI Crawlers.