a how-to

add posthog to wordpress.

PostHog tells you what people actually do on your site: where they come from, what they click, where they give up. Getting it onto WordPress properly takes a little more than pasting a snippet, so here’s the whole thing.

I’m a PostHog Community Champion, and I wrote Pressed Hog, the free plugin this guide uses, because I kept answering the same set-up questions.

step by step

from nothing to tracking

1. make a posthog account

Sign up at posthog.com. Pick the EU region if you’re in the UK or Europe, so the data is stored in Frankfurt. No card is needed for the free tier.

2. install pressed hog

Install Pressed Hog on your WordPress site. A set-up wizard opens on activation.

3. paste your project key

Choose your region, then paste the project API key from your PostHog project settings. It starts with phc_. The wizard checks it works before you go on.

4. choose what to track

Page views, autocapture of clicks, session replay and surveys each have their own switch. Admins and editors are left out by default, so your own visits don’t skew the numbers.

5. sort out consent

Pick how tracking waits for consent: Pressed Hog’s own banner, or the cookie plugin you already use. In the UK, analytics cookies need consent, so don’t skip this.

6. send a test event

The last step sends a test event and checks it arrived. Then open PostHog and watch your first visits come in.

worth switching on

the extras

woocommerce events

Add to basket, checkout and completed orders, sent to PostHog so you can see where buyers drop out.

a reverse proxy

Sends PostHog through your own domain, so fewer ad blockers stop it. Needs pretty permalinks.

stats in wordpress

Page views, visitors and top pages on your dashboard, with a read-only PostHog key.

what it costs

free for most small sites

PostHog’s free tier covers 1 million events, 5,000 session recordings and 1,500 survey responses a month, as of October 2026. Most small business sites never go past it. Pressed Hog is free.

rather not?

have it done for you

If you’d rather skip all this, I’ll set up PostHog around the questions you want answered, with consent done properly and one dashboard you’ll actually open.

questions

the honest answers

Do I need a cookie banner?

In the UK, analytics cookies need consent, so yes, unless you set PostHog up not to store anything on the visitor’s device. Pressed Hog can hold tracking back until someone agrees.

Does it work with self-hosted PostHog?

Yes. Pick self-hosted in the wizard and enter your own address.

Where do I get Pressed Hog?

It’s been submitted to wordpress.org. Until it’s listed there, ask me for a copy.

want it done properly?