> For the complete documentation index, see [llms.txt](https://docs.humblytics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.humblytics.com/how-to-get-started/wordpress.md).

# WordPress

Add Humblytics to your WordPress site in about 3 minutes.

{% hint style="info" %}
**You need:** admin access to install plugins. On WordPress.com, that means a plan that allows plugins.
{% endhint %}

## 1. Copy your tracking code

In Humblytics, open **Site settings → Install** and click **Copy tracking code**. Adding a new site? The code appears in step 2 of **Add Site**.

Copy the whole snippet, from `<!-- Start Humblytics Tracking Code -->` to `<!-- End Humblytics Tracking Code -->`.

## 2. Paste it into WordPress

The easiest way is the free **WPCode** plugin. It keeps the script in place when you change or update your theme.

1. Go to **Plugins → Add New**, search for **WPCode**, then click **Install Now** and **Activate**.
2. Go to **Code Snippets → Header & Footer**.
3. Paste the snippet into **Header** and click **Save Changes**.

<figure><img src="https://1281224403-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqZMBn2D7F1lV2hgGTS2X%2Fuploads%2FsQRHdaMtK6sUwA0lxuJw%2Fcustom%20code%20script.gif?alt=media&amp;token=670adf7b-a09d-4d95-888d-848e32016dca" alt=""><figcaption></figcaption></figure>

**Prefer code?** In a child theme's `functions.php`, print the snippet inside a `wp_head` action. Avoid editing the parent theme's `header.php`: theme updates overwrite it.

## 3. Clear cache and verify

1. Clear your caching plugin and any CDN cache (Cloudflare, host cache). Otherwise visitors keep getting the old page without the script.
2. Back in Humblytics, click **Verify install**.
3. Open your live site in a private window and click around. Your visit appears in **Observe → Analytics → Overview** under **Live Activity** within about a minute.

## Installed but not tracking?

A JavaScript optimization setting is the usual cause. Features that **combine, minify, defer, or delay JavaScript** can break the Humblytics script even though it's in your page. Exclude it in the tool you use, using both keywords `hmbl.min.js` and `_hmblReveal`:

| Tool                         | Where to exclude                                                                                                                                       |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **WP Rocket**                | **Settings → WP Rocket → File Optimization**: add both keywords to the exclusions for **Minify/Combine JavaScript** and **Delay JavaScript execution** |
| **SiteGround Optimizer**     | **Frontend → JavaScript**: exclude Humblytics from **Combine** and **Defer**                                                                           |
| **W3 Total Cache**           | **Performance → Minify**: add `hmbl.min.js` to **Never minify the following JS files**                                                                 |
| **LiteSpeed Cache**          | **Page Optimization → Tuning**: add both keywords to **JS Excludes** and **JS Deferred / Delayed Excludes**                                            |
| **Cloudflare Rocket Loader** | Turn it off, or add `data-cfasync="false"` to both `<script>` tags in the snippet                                                                      |

Clear all caches after changing these settings, then verify again.

Also check that security plugins (Wordfence, Sucuri) aren't blocking `app.humblytics.com`. More fixes: [Verify & Troubleshoot Tracking](/how-to-get-started/verify-and-troubleshoot-tracking.md).
