Overview
Custom events allow you to track specific user interactions beyond pageviews, such as button clicks, form submissions, video plays, purchases, and more. Unlike pageviews, custom events require explicit tracking calls.Tracking Methods
There are three ways to track custom events in Plausible:- JavaScript API - Programmatically track events using the
track()function - Tagged Elements - Automatically track clicks on elements with CSS classes
- Auto-capture - Enable automatic tracking of file downloads, outbound links, and form submissions
JavaScript API
Basic Event Tracking
Use thetrack() function to send custom events:
Event Options
Thetrack() function accepts an options object with the following fields:
object
Custom properties to attach to the event. All keys and values must be strings.
boolean
default:"true"
Whether the event is interactive. Non-interactive events don’t affect bounce rate calculations.
object
Revenue information for ecommerce tracking.
function
Called when the tracking request completes or is ignored.
string
Override the URL of the page where the event occurred. By default, uses
location.href.Tagged Events
Tagged events allow you to track interactions without writing JavaScript. Simply add CSS classes to your HTML elements.Basic Tagged Elements
Add theplausible-event-name class to track clicks:
Use
+ or spaces to separate words in event names within class names.Tagged Events with Properties
Add custom properties using additional classes:Alternative Syntax
You can use-- instead of = for better compatibility with some frameworks:
Tagged Links
When tracking clicks on links, the URL is automatically added as a property:Tagged Forms
Track form submissions by adding classes to the<form> element:
Auto-capture Features
Plausible can automatically track common interactions when enabled.File Downloads
Automatically track clicks on file download links:Custom File Types
- NPM Package
- Script Tag
url property:
Outbound Links
Automatically track clicks on external links:An outbound link is any link where the
host differs from the current page’s location.host.Form Submissions
Automatically track form submissions:Combined Features
Use a combined script to enable multiple features:script.js- Base trackerscript.file-downloads.js- With file download trackingscript.outbound-links.js- With outbound link trackingscript.tagged-events.js- With tagged events support- Combinations like
script.outbound-links.file-downloads.js
Revenue Tracking
Track revenue and ecommerce conversions:number | string
required
Revenue amount in the specified currency.
string
required
ISO 4217 currency code (e.g., “USD”, “EUR”, “GBP”).
Event Naming Guidelines
1
Use Clear, Descriptive Names
Choose names that clearly describe the action:
- ✅ “Signup”, “Download PDF”, “Add to Cart”
- ❌ “Event1”, “Click”, “Action”
2
Be Consistent
Use a consistent naming convention across your site:
- Capitalization: “Signup” or “signup”, not both
- Spacing: “Add to Cart” or “Add_to_Cart”, not both
3
Keep It Simple
Avoid overly long or complex names. Use properties for additional context.
4
Configure Goals
Remember to add custom events as goals in your Plausible dashboard to see them in reports.
Common Patterns
Button Clicks
Video Engagement
Newsletter Signups
E-commerce Events
Next Steps
Custom Properties
Add metadata and context to your events
Events API
Server-side event tracking