# WordPress

> Add the Attrifast snippet to your WordPress site — via the WPCode plugin or a one-line theme edit — and see your first pageview, usually within a minute.

Last updated: 2026-07-17
Canonical: https://attrifast.com/docs/wordpress

Attrifast works on WordPress the same way it works everywhere: one script tag in your site's `<head>`. No theme-specific configuration, and the tracker is ~2.4 KB over the wire with no cookies by default.

<Callout>

Event collection requires an active subscription or trial — start the 7-day free trial during onboarding (no charge today, cancel anytime). On the free plan, the verify step below won't light up because events aren't collected.

</Callout>

## Step 1 — Get your snippet

Add your site in Attrifast (onboarding step 1, or the dashboard), then open onboarding step 2 **"Install script"** → the **WordPress** tab, or **Dashboard → Settings → Install script** → **WordPress**. Copy your snippet — it looks like this, with your own tracking ID:

```html
<script defer data-tracking-id="YOUR_TRACKING_ID" src="https://api.attrifast.com/af.js"></script>
```

## Step 2 — Add it to WordPress

<Steps>
<Step title="With a plugin (recommended)">

Install [WPCode (Insert Headers and Footers)](https://wordpress.org/plugins/insert-headers-and-footers/) from the WordPress plugin directory, then paste the snippet under **Header** and save. This survives theme updates and works on any theme.

</Step>
<Step title="Without a plugin">

Go to **Appearance → Theme File Editor → header.php** and paste the snippet right before `</head>`.

This route needs a classic theme with a `header.php` (block themes and some managed hosts don't expose the file editor) — and a theme update can overwrite the edit, so prefer the plugin route when you can.

</Step>
</Steps>

## Step 3 — Verify

Click **Verify installation** in onboarding, then open your WordPress site in another tab. The verifier flips to *"Script verified! Events are being received."* once the first pageview lands — or just check your dashboard, where the visit usually appears within a minute.

<Callout>

The domain registered in Attrifast must match the domain WordPress serves from (subdomains of it are fine). If you registered `www.example.com` but serve from apex `example.com`, events are rejected — register the apex domain instead, or [contact us](/contact) to adjust your allow-list.

</Callout>

## What you get

Everything in [Install the tracker](/docs/install): pageviews, channel classification (including AI engines), engagement time, and UTM capture. WooCommerce order attribution isn't supported yet — for e-commerce revenue attribution, see [Shopify](/docs/shopify) or [Stripe](/docs/stripe).
