# WordPress

The **FlarePanel Analytics** plugin adds tracking to every public page. With your client secret, it also reports AI crawlers (GPTBot, ClaudeBot, PerplexityBot and the rest) from your server, and with WooCommerce it records orders as revenue.

:::info
The plugin is waiting for its WordPress.org listing. Until then, [download the zip](https\://docs.flarepanel.dev/downloads/flarepanel-wordpress.zip) and upload it under **Plugins → Add New Plugin → Upload Plugin**.
:::

## Set it up

1. Install and activate **FlarePanel Analytics**.
2. In FlarePanel, open your project's **Settings → Clients** and copy the client ID. No account yet? [Start a 30-day trial](https\://dashboard.flarepanel.dev/onboarding), no card needed.
3. In WordPress, open **Settings → FlarePanel**, paste the client ID and save.

Open your site in a private window and visit a few pages. They appear in **Realtime** within seconds.

## What it does

| Setting | What it does |
|---|---|
| **Client ID** | Loads the FlarePanel script on public pages. The client ID is public; it is safe in your HTML. |
| **Do not track** | Logged-in users with these roles are not counted. Administrators and editors are left out by default. |
| **Clicks on links to other sites** | Sends an event for each outbound link click. |
| **Clicks on elements with `data-track`** | Sends an event for any element with a [`data-track` attribute](/tracking/events). |
| **WooCommerce orders as revenue** | On the order-received page, sends the order total as [revenue](/tracking/revenue), once per order, with its currency, order ID and number of items. |
| **Client secret** | Turns on AI crawler reports (below). It stays on your server and is never printed into pages. |
| **Traffic widget link** | Shows your traffic chart on the WordPress dashboard. Copy it from **Settings → Widgets → Traffic** in FlarePanel. |

## AI crawlers

Crawlers never run JavaScript, so the script cannot see them. With a client secret, the plugin checks each page request on your server. When the user agent looks like a bot, it sends the path, the user agent, the referrer and the response status to [`/track/crawl`](/tracking/ai-crawlers) after the page has gone out, so visitors never wait for it. Human visits are never sent this way. The results show up on the **Bots & AI crawlers** page.

Create the secret in FlarePanel under **Settings → Clients** (it is shown once), then paste it into **Client secret** in the plugin settings.

:::warning
Pages served from a full-page cache (some caching plugins, or a CDN in front of WordPress) never reach PHP, so crawler visits to them are not reported. If your site is on Cloudflare, [connect Cloudflare](/tracking/ai-crawlers#connect-cloudflare-no-code) as well; it reads crawler traffic from your zone with no code.
:::

## Self-hosted FlarePanel

Open **Self-hosted FlarePanel** at the bottom of the settings and set\:

* **API URL**\: your API, for example `https://api.example.com`.
* **Script URL**\: where your `op1.js` is served.

## For developers

| Filter | Use |
|---|---|
| `flarepanel_should_track` | Return `false` to skip tracking on a request. |
| `flarepanel_init_options` | Change the options passed to `op('init', …)`. |
| `flarepanel_crawl_hit` | Change or drop (`null`) a crawler report before it is sent. |
| `flarepanel_order_properties` | Change the properties sent with a WooCommerce order. |

```php
// Do not track the checkout page.
add_filter( 'flarepanel_should_track', function ( $track ) {
	return $track && ! is_checkout();
} );
```

The plugin's source is in the FlarePanel repository under [`integrations/wordpress`](https\://github.com/flarepanel-dev/flarepanel/tree/main/integrations/wordpress).
