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:

Recommended option: Use the Plausible Analytics plugin#

This is the recommended way to integrate Plausible Analytics with your WordPress website if you want a nice Plausible configuration page directly in your WordPress dashboard.

Plausible Analytics plugin

"Plausible Analytics plugin" is built and maintained with the help from Mehul Gohil. It supports these features:

You can install the Plausible Analytics plugin 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 the name of the plugin and click on the "Install Now" button. After the installation is finished, click on the "Activate" button.

"Plausible Analytics" will now show up in the "Settings" section in the left-hand side navigation within your WordPress dashboard. Click on it to explore the different options available.

How to track 404 page errors with the WordPress plugin#

404 error pages won't show up automatically. You'll have to configure the goal for them to show up on your dashboard.

To configure a goal, go to your website's settings in your Plausible Analytics account and visit the "Goals" section. You should see a prompt to add a goal.

Add your first goal

Click on the "+ Add goal" button to go to the goal creation form.

Select Custom event as the goal trigger and enter this exact name: 404.

Add 404 error pages goal

Next, click on the "Add goal" button and you'll be taken back to the Goals page. After you've completed this process, all the 404 error pages will start being tracked and will be displayed in the "Goal Conversions" report of your Plausible Analytics dashboard. You'll see "404" goal as soon as the first visit on an error page has been tracked.

Click on "404" to see the full list of all visits on all error pages and have your dashboard filtered by error pages only. Click on a particular error page URL to filter the dashboard by those clicks only and get the full overview of that specific URL. Then you can figure out how your visitors discover the broken links and fix them.

How to track outbound link clicks with the WordPress plugin#

Outbound link clicks won’t show up automatically. You’ll have to configure the goal for them to show up on your dashboard.

To configure a goal, go to your website’s settings in your Plausible Analytics account and visit the "Goals" section. You should see a prompt to add a goal.

Add your first goal

Click on the "+ Add goal" button to go to the goal creation form.

Select Custom event as the goal trigger and enter this exact name: Outbound Link: Click.

Add Outbound Link Click goal

Next, click on the "Add goal" button and you’ll be taken back to the Goals page. After you've completed this process, all the external link clicks will start being tracked and will be displayed in the "Goal Conversions" report of your Plausible Analytics dashboard. You'll see "Outbound Link: Click" goal as soon as the first external link click has been tracked.

And that's it. You are now using our WordPress plugin to count your stats including 404 error pages and outbound link clicks.

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

The development of our WordPress plugin is done in the open on GitHub so you can take a look and submit any feature requests.

Alternative ways to integrate Plausible with WordPress#

There are several alternatives thanks to the members of our community. Note that these plugins are community maintained and therefore we take no responsibility for them. Check the individual plugin to see whether it's up to date and supports the features that you need.

Plausible Connector plugin#

"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.

Unofficial Plausible Analytics plugin#

"Unofficial Plausible Analytics plugin" built and maintained by Joe Clarke of TaskBill.io. It allows you to exclude admin users from having their visits and page views recorded.

Full Picture plugin#

"Full Picture plugin" built and maintained by Krzysztof Płaneta. It's very feature-rich and you can see the list of its features here.

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.

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

Manually modify your header.php file#

This is the manual 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.