Creating a Plausible Account
Before enabling this plugin, make sure that you have created an account with Plausible and added your domain to your account; without an active account, no data can be collected by Plausible.
A full guide to signing-up with Plausible can be found in their documentation. Make a note of the domain that you entered when adding your website to Plausible, as this will need to be entered into the plugin settings in Publii.
Enabling the Plugin
To activate the plugin, open the Tools & Plugins section of the Publii app via the left-menu to see a list of installed plugins. Click on the switcher button in the bottom-left of the Plausible Analytics Integration box in this list to enable the plugin.
You'll need to add some information to the plugin before it can function properly, so now click on the plugin box to open the Plugin Options screen.
Plausible Analytics Integration Options
Plausible is very simple to use, so only one option in this section is required; Domain; the other options can be enabled as and if you need them:
- Domain - Enter the domain that you will be tracking through Plausible Analytics here; make sure it is the same domain as entered when adding your website to your Plausible account.
- Script URL - This option allows you to enter the URL to point to the self-hosted plausible.js file. By default or when empty it will always link to the plausible.io domain (https://plausible.io/js/plausible.js)
- Enable 404 tracking: Enable this option to specifically track 404 error pages, enhancing your capability to analyze visitor behavior and page performance.
- Output Code in Preview Mode - Enabling this option will add Plausible analytics code to your site when opening a preview, which can be useful for debugging. Generally, this option should not be enabled as it may affect the accuracy of the tracking data that is sent to Plausible.
Note on Enabling 404 Error Page Tracking
When you enable the option to track 404 error pages, additional setup is required on your Plausible Analytics account to capture these events.
- Set Up a Custom Event Goal: Navigate to the settings of the specific website you are tracking within your Plausible Analytics account and go to the "Goals" section. There, you'll find an option to define a new goal.
- Initiate Goal Creation: Click the "+ Add goal" button, which will take you to the goal creation form.
- Configure Goal Trigger: Choose "Custom event" as the trigger type and input the name "404" to specifically track 404 error pages.
- Complete Goal Setup: Click the "Add goal" button to finalize the process. You'll be redirected to the Goals section where you can confirm the goal has been added.
Once this is configured, tracking of 404 error pages will initiate. These will appear in the "Goal Conversions" section of your Plausible Analytics dashboard. The goal named "404" will be visible as soon as the first 404 error page is visited.
To dive deeper into the data, click on the "404" goal. This will provide a detailed list of visits to all tracked 404 error pages. From this data, you can ascertain how users are encountering broken links, enabling you to take corrective actions accordingly.
Cookie Banner Integration
- Cookie Group ID - This option only becomes available when the Cookie Banner Integration option is enabled. Here, you can specify the cookie group that the Plausible Analytics cookies should be added to, e.g. 'analitics'. Make sure to add (if it doesn't exist) this group name to the GDPR section of the site settings. You can find instructions on how to do this in the GDPR section of this documentation.