If you use the Custom Events feature, then these count towards your billable monthly pageviews.
First, make sure your tracking setup includes the second line as shown below
This snippet creates a global function called
plausible which can be used to trigger custom events from anywhere in your code.
Here’s what triggering a custom event looks like
The event name can be anything. As a second parameter, you can also send an object with options. The supported options at the moment are:
callback– a function that is called once the event is logged successfully.
props– an object with custom properties for the event
This is the whole extent of the API. It's intentionally very slim so as to keep the SDK small and quick to load.
If you want to trigger form submissions, button clicks etc. you need to implement the code for that yourself. This is an example of code we use to track custom events (trial signups) on our own website. We have listed few other code examples further down this page.
When you start sending custom events to Plausible Analytics, they won’t show up automatically. You’ll have to configure the goal for the conversion numbers to show up.
To configure a goal, go to your website’s settings in your Plausible Analytics account and visit the "Goals" section. You should see an empty list with a prompt to add a goal.
Click on the "+ Add goal" button to go to the goal creation form.
Custom event as the goal trigger and enter the name of the custom event you are triggering. The names must be an exact match to the one on your site for the conversions to show up in your analytics dashboard.
Next, click on the "Add goal" button and you’ll be taken back to the Goals page. When you navigate back to your Plausible Analytics dashboard, you should see the number of visitors who triggered the custom event. Goal conversions are listed at the very bottom of the dashboard.
Custom properties can be attached to events to capture dynamic elements and to further break down goal conversions. You can use custom properties to create your custom metrics to collect and analyze data that Plausible doesn’t automatically track.
You can then filter and sort your goals by custom event properties in your Plausible dashboard. For those coming from Google Analytics, custom properties are roughly the same concept as custom dimensions in GA.
For example, in addition to tracking file downloads you might want to know which supported download method your visitors are using. Instead of creating separate goals for each download method, you can send a custom property instead:
This way you can neatly track total downloads and also break them down by the method without cluttering your dashboard. Here's how it will look like:
Want to have multiple custom properties for the same event? You can do it like this:
The number of custom properties you can add per event is unlimited. And the names can be anything that you want. In our example, there are 4 properties that have been set up for segmenting:
Version, Region, OS, Method.
Custom properties only accepts scalar values such as strings, numbers and booleans. Data structures such as objects, arrays etc. are not accepted.
Custom properties will show up automatically on your dashboard as long as you've added the goal itself. You don't need to manually add them in your settings.
Plausible will display
(none) in your dashboard when you send a custom property key with no value, or
undefined as a value.
Note that you must ensure that no personally identifiable information (PII) is sent to Plausible Analytics with custom properties. PII is information that could be used on its own to identify, contact, or precisely locate an individual. This includes:
- full names or usernames
- email addresses
- mailing addresses
- phone numbers
- credit card information
- passport numbers
- precise locations
- IP addresses
- pseudonymous cookie IDs, advertising IDs or other pseudonymous end user identifiers
Register events in the HTML with the use of an attribute tag
Note: Watch your quotes! Especially in the props as we want to be able to create an object.
To be able to read the
And here's an example of the code you need to insert if you're using the Contact Form 7 plugin on WordPress and want to see the number of visitors who use the contact form. In this example, there are two contact forms on two different pages and this is the code you should insert in the