# Install PulseAI on WordPress

This server-side plugin does not require Cloudflare. It reports selected public HTML requests that actually reach a **single-site WordPress 6.4+ installation running PHP 8.3+** with a working WordPress database and scheduler. You need permission to install a plugin and edit server-side configuration. A WordPress.com plan or managed host must allow those operations; a theme-only code box is not sufficient.

It is passive request reporting. It does not block visitors, independently verify crawler operators or reliably identify AI operating an ordinary browser. Unknown is shown as Estimated human.

## 1. Confirm coverage before subscribing

Choose a small list of public pages such as `/`, `/pricing/` and `/about/`. Do not include administration, checkout, account, API or private/customer-specific paths. This plugin deliberately excludes logged-in WordPress visitors, authorized requests, admin/Ajax/REST/cron traffic and non-HTML responses.

**Full-page caching matters:** a CDN, reverse proxy, static page export or WordPress page cache can answer a request before this plugin runs. Those requests will not appear here. Do not claim complete traffic totals. Use the Cloudflare edge collector, another supported server/edge collector, or request-log import when the upstream cache offers appropriate access. Do not disable a customer's cache merely to create analytics coverage.

## 2. Prepare the PulseAI property

1. Visit https://pulseaianalytics.com/dashboard and sign in.
2. Add the exact public hostname you own; `example.com` and `www.example.com` are different hostnames.
3. Publish the ownership proof file at the displayed `/.well-known/` location and complete **Check ownership**. The plugin does not serve the proof file for you.
4. Copy the nonsecret **Website ID** and create a server collector key. Keep that key private.
5. Confirm the current Starter offer and subscription. Ownership preparation alone does not activate ingestion; accepted events require the property's owner to have an active server-confirmed subscription. There are no automatic paid overages.

## 3. Set server-only configuration

Back up `wp-config.php`. Add these definitions **before** the line that loads `wp-settings.php`. Replace the placeholders with your own values. Do not paste the secret into a page, theme JavaScript, public repository, screenshot or browser code box.

```php
define('PULSEAI_SITE_ID', 'YOUR_WEBSITE_ID');
define('PULSEAI_CUSTOMER_HOSTNAME', 'www.example.com');
define('PULSEAI_INGESTION_KEY', 'YOUR_PRIVATE_PULSE_INGEST_KEY');
define('PULSEAI_PUBLIC_PATHS_JSON', '["/","/pricing/","/about/"]');
```

Use HTTPS for WordPress's public **Site Address** and keep the same hostname in the configuration. The plugin checks WordPress's configured home URL, incoming hostname and HTTPS state. If a trusted reverse proxy terminates HTTPS, your host must already configure WordPress's HTTPS detection correctly. Do not trust arbitrary forwarded headers or disable HTTPS verification to fix a mismatch.

`PULSEAI_PUBLIC_PATHS_JSON` must contain 1–100 exact nonsensitive paths, each at most 200 characters. Trailing slashes matter. Start with `/`; add paths once you have reconciled the first visit. Queries, raw user agents, cookies, request bodies, page content and typed text are never sent. Source IPs are not stored; supported recent requests may separately send a transient IP for operator verification. Crawler declarations are derived locally from the supplied user-agent text, then the raw header is discarded.

## 4. Upload and activate the plugin

1. Download **pulseai-wordpress.zip** from the PulseAI installation page.
2. In WordPress, open **Plugins → Add New Plugin → Upload Plugin**.
3. Choose the ZIP, install it and activate **PulseAI Server Collector**.
4. The plugin creates four small tables with your WordPress table prefix: `pulseai_queue`, `pulseai_state`, `pulseai_leases`, and `pulseai_rejections`. Your database user needs normal WordPress table-creation/read/write privileges.
5. Open **Tools → PulseAI collector** as an administrator. Confirm `configured: true`, a scheduled delivery time and no configuration/storage error. The page does not display your secret or event contents.

The plugin is for single-site WordPress. Multisite/network activation is not supported. Server-restricted hosts that prohibit outbound HTTPS or custom database tables require a different integration.

## 5. Verify a real visit and delivery

1. Open an allowlisted public page **while signed out of WordPress**, using a separate browser/private window. An administrator's signed-in visit is intentionally excluded.
2. Return to **Tools → PulseAI collector**. `counter:enqueued` should increase. A queued event is not yet a delivered event.
3. Use **Try delivery now**, or wait for scheduled delivery. This administrator-only action uses a WordPress nonce and permission check.
4. Confirm `counter:acknowledged` increases and `lastAcknowledgedAt` appears. Check `lastHttpStatus` and `lastFailure` if delivery is not acknowledged.
5. In PulseAI, choose that website and confirm the page/time, request evidence, usage and last-delivery timestamp. Reconcile one controlled visit before relying on reports.
6. Repeat using a nonsensitive query such as `/?test=one`. The stored path must remain `/`; no query is retained. A declared crawler name is a self-report, not a verified operator identity.

Normal website responses, cookies, cache directives and authentication are not changed by this plugin. No remote delivery happens in the page hook: it saves a local event and the scheduler sends batches. Database work still has some overhead, so validate latency and response behavior on staging.

## 6. Keep the scheduler running

The plugin schedules a delivery attempt every minute, sending up to 50 events per run and at most 32 KiB per batch. WordPress cron depends on visits and may be delayed on a quiet website. A cron timestamp is not proof of an executed delivery.

If your host disables WP-Cron, arrange its supported system scheduler to run due WordPress cron events, for example with WP-CLI:

```sh
wp cron event run --due-now --path=/path/to/wordpress
```

Run that from the account that manages the WordPress installation. Confirm the exact command, schedule and permissions with your host; do not enable two competing cron mechanisms unintentionally. Inspect `lastRunAt`, queue age and acknowledged deliveries after deployment.

## Queue, recovery and limits

- Events use stable IDs and their original observation times across retries and process restarts. Only receiver-acknowledged IDs are removed as delivered. A lost response is retried and the receiver deduplicates the same ID.
- The database outbox holds at most **10,000 pending events**. Overflow and brief enqueue-lock contention are counted as lost observations, not delivered traffic. This is not a guarantee that every request is captured.
- Backoff grows after failures. Invalid keys, pending ownership, inactive subscriptions and HTTP 429 pause rapid delivery for an hour; repair the cause and check again. The page continues to work while reporting fails.
- Events older than seven days cannot be accepted. Expired and explicitly time-rejected events are counted as rejected; up to 100 rejection IDs/reasons remain locally for reconciliation.
- The local outbox is permanently bound to its initial Website ID and hostname. Key rotation for that same property is supported. Do not point an existing queue at another customer/property/hostname. Use a separate installation/database table prefix and an explicitly reviewed migration.
- Rotating the key in PulseAI invalidates the previous key immediately. Update `wp-config.php`; queued events then retry unchanged using the new key. Never weaken domain or subscription checks to recover a queue.
- Deactivation stops observation and removes the scheduled hook, but retains queued records and counters for recovery. Reactivation resumes with the same property. Removing tables is a separate deliberate data-deletion operation; retain a backup and do not delete another plugin's tables.

## Troubleshooting

| Symptom | Check |
| --- | --- |
| `configuration_invalid` | All four constants, exact HTTPS home hostname, key format and safe JSON paths. |
| `storageError: storage_unavailable`, `pending: null` | Database/schema access failed. Pending is unknown, not zero; check table-creation/read/write permissions and reactivate only after repairing storage. |
| No queued visit | Signed-out public GET, exact allowlisted path/hostname, HTML response, HTTPS detection, and whether cache bypassed WordPress. |
| Queue grows, no `lastRunAt` | WP-Cron/system scheduler actually running; outbound loopback/cron restrictions. |
| `network_or_timeout` | Outbound HTTPS/DNS/CA configuration. TLS verification remains enabled. |
| HTTP 401/403 | Correct property key and verified domain; check rotation. |
| HTTP 402 | Server-confirmed subscription and provider availability. |
| HTTP 429 | Account event allowance or receiver rate limit. No automatic paid overage. |
| `invalid_acknowledgement` / `redirect_refused` | Keep the queue; check a proxy/security plugin modifying outbound responses. The destination is fixed to the production PulseAI endpoint and redirects are not followed. |
| `outbox_binding_mismatch` | Configured Website ID/hostname changed. Restore the original binding; do not relabel pending customer records. |
| `queueOverflow` / `queueContention` | Missing observations occurred. Repair delivery/capacity and disclose the gap. |

Ask support at **insights@pulseaianalytics.com** with version, safe diagnostics and the approximate time. Do not include the key, raw private logs or credentials.

Official references: [WordPress plugin upload](https://wordpress.org/documentation/article/manage-plugins/), [WP-Cron](https://developer.wordpress.org/plugins/cron/), [WordPress HTTP API](https://developer.wordpress.org/plugins/http-api/).

## November 1 operator verification update

Read the [verification, privacy and upgrade guide](https://pulseaianalytics.com/downloads/pulseai-operator-verification.md) before enabling the new network checks. The current catalog includes 227 reviewed names. This version also records browser-consistency signals, the type and name of the referring source (never the URL) and, where your edge supplies one, a country code. Signed agents such as ChatGPT's browser agent can be verified. A country is read from `HTTP_CF_IPCOUNTRY` only for requests from a configured trusted proxy. Supported recent requests can obtain a request-bound official-network verification receipt; raw IPs never enter the durable queue or event records. Preserve your existing IDs, keys and pending queue when upgrading. WordPress uses REMOTE_ADDR unless trusted proxy ranges and a single replacement header are configured. Set PULSEAI_OPERATOR_VERIFICATION to false to disable network verification.

## Browser visits and Visitors

This collector reports requests in its collection scope. To also see browser-visit estimates in **Visitors**, install the complementary [page tag](https://pulseaianalytics.com/downloads/pulseai-page-tag.md) on your public pages using the same verified Website ID. The tag adds page views, sessions, engagement and browser-input signals; it does not replace the collector or verify that a visitor is a person. Unrecognized agents can remain in Estimated human totals, and false positives can exclude people.

The tag uses localStorage and sends per-page IDs for updates, without a persistent visitor ID. Review your privacy notice and applicable consent requirements before installing it. Each tag page view uses one event from your monthly allowance in addition to collector request events; tag updates use no additional events.
