---
url: https://simpledatalogs.com/docs/integrations/wordpress.md
description: >-
  The simpledatalogs WordPress plugin; cookie-free page views, opt-in
  autocapture, server-side events for users, comments and WooCommerce, and how
  it handles privacy.
---

# WordPress

The simpledatalogs plugin connects a WordPress site in a minute: paste a public key, and page views start arriving. The browser SDK is bundled with the plugin; nothing loads from a CDN.

* WordPress 6.3+ and PHP 7.4+.
* No cookies.
* Never tracks wp-admin.

## Install

1. In WordPress, go to **Plugins → Add New** and search for **simpledatalogs**.
2. Install and activate it.

::: info Early access
The plugin isn't on wordpress.org yet. Until it is, download the ZIP from [GitHub](https://github.com/XKD-Labs/simpledatalogs-wordpress) (**Code → Download ZIP**) and upload it under **Plugins → Add New → Upload Plugin**.
:::

## Set it up

1. Open **Settings → simpledatalogs**.
2. Paste a public key (`sdl_pub_…`) and save. Secret keys are refused, because they must never appear in web pages.
3. Press **Send test event**. A success notice means `setup_test` was accepted.

## What it sends

| Setting | Default | What you get |
|---|---|---|
| Page views | on | `page_view` on every public page, with `path` and `title` |
| Autocapture | off | Page views, sessions and JavaScript errors, from the bundled [JavaScript SDK](/sdks/javascript#autocapture) |
| Server-side events | off | Events sent from your server, picked one by one (below) |

Server-side events, once turned on:

| Event | When | Props |
|---|---|---|
| `user_registered` | A new user registers | `role` |
| `user_logged_in` | A user logs in | `role` |
| `comment_posted` | A comment is posted | `status`, `post_type` |
| `order_completed` | A WooCommerce order completes | `total`, `currency`, `item_count`, `payment_method` |
| `add_to_cart` | A WooCommerce product is added to the cart | `product_id`, `quantity` |

Each server event gets its `event_id` and `ts` when it happens, and all of a request's events go in one non-blocking batch.

## Your own events

Your theme can send its own events through the global client:

```js
simpledatalogs.track('newsletter_signup', { form: 'footer' })
```

## Privacy and consent

* **No cookies.** Unsent events wait in the browser's `localStorage`, and autocapture keeps its session id in the tab's session storage.
* **Do Not Track and Global Privacy Control** turn tracking off, including your theme's own calls. This is on by default.
* **Roles.** Logged-in users with the roles you pick are never tracked, in the browser or on the server. Administrators are excluded by default.
* **No personal data.** No names, emails or IP addresses are put in events.
* Nothing is sent until you save a key.

## Page caching

The plugin works with page caches. The script reads its settings from the page, and the privacy checks run in the browser. Role exclusion applies to logged-in users, whose pages caches usually skip.

## Troubleshooting

| Test result | What to do |
|---|---|
| `401` | The key was refused. Check that it's a current public key; a new key takes a few seconds to go live |
| Could not be reached | Your server can't reach the ingest host. Leave **Ingest host** empty unless support gave you another |
| Anything else | Try again in a minute |

## Next steps

* [JavaScript SDK](/sdks/javascript): the bundled client is version 0.3.0, so web mode and `data-track` clicks come with a later plugin release.
* [Privacy for senders](/reference/privacy): what to keep out of events.
