How to add the script to your WordPress site

There are several simple ways to integrate Plausible Analytics with your WordPress website. Let's take a look at them:

Option 1: Plausible Analytics community plugins

This is the recommended way to integrate Plausible Analytics with your WordPress website as it gives you a nice Plausible Analytics configuration page directly in your WordPress dashboard:

  • "Plausible Connector plugin" built and maintained by alyx. It supports serving the Plausible script from a custom domain, using your self-hosted instance instead of Cloud, custom events and the ability to exclude admin users from having their visits and page views recorded.
Plausible Connector pluginUnofficial Plausible Analytics Plugin

You can install these community plugins in the "Plugins" section in the left-hand side navigation within your WordPress dashboard. Click on "Add New" and in the search field in the top right, search for the name of the plugin.

Option 2. A general plugin

Search for and install Insert Headers and Footers plugin

"Insert Headers and Footers" is a well-supported plugin with more than 1 million active users and created by Syed Balkhi and the WPBeginner team. It allows you to easily insert any code into your header without editing theme files. You can use this plugin to insert Google Analytics, Plausible Analytics and any other script.

In the "Plugins" section in the left-hand side navigation within your WordPress dashboard, click on "Add New". In the search field in the top right, search for "Insert Headers and Footers" and click on the "Install Now" button. After the installation is finished, click on the "Activate" button.

"Insert Headers and Footers" will now show up in the "Settings" section in the left-hand side navigation within your WordPress dashboard. Click on it to add your scripts.

Paste your Plausible Analytics tracking code in the "Scripts in Header" field and click on the "Save" button. In case you do have a caching plugin installed, clear the cache just in case.

Paste your Plausible Analytics tracking code

Now you can go to your website to verify if the Plausible Analytics script has been added and to your Plausible Analytics account to see whether the stats are being tracked.

Option 3. Modify a file

This is the alternative option. In the "Appearance" section in the left-hand side navigation within your WordPress dashboard, click on "Theme Editor". Choose your theme in the top right (your current theme should be selected by default) and click on "Select". In "Theme Files" locate the "header.php" file.

Modify your header.php file

Paste your Plausible Analytics tracking code between

... tags like seen in the screenshot and click on the "Update File". In case you do have a caching plugin installed, clear the cache just in case. Note that you will need to do this process every time you update your theme unless you create a child theme.

Now you can go to your website to verify if the Plausible Analytics script has been added and to your Plausible Analytics account to see whether the stats are being tracked.