Skip to main content

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:
  1. JavaScript API - Programmatically track events using the track() function
  2. Tagged Elements - Automatically track clicks on elements with CSS classes
  3. Auto-capture - Enable automatic tracking of file downloads, outbound links, and form submissions

JavaScript API

Basic Event Tracking

Use the track() function to send custom events:

Event Options

The track() 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 the plausible-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:
This tracks a “Signup” event with properties:

Alternative Syntax

You can use -- instead of = for better compatibility with some frameworks:
When tracking clicks on links, the URL is automatically added as a property:
This creates an event with:

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:
Default tracked file types:

Custom File Types

File downloads are tracked as “File Download” events with a url property:
Automatically track clicks on external links:
Outbound link clicks are tracked as “Outbound Link: Click” events:
An outbound link is any link where the host differs from the current page’s location.host.

Form Submissions

Automatically track form submissions:
Form submissions are tracked as “Form: Submission” events when the form passes validation.
If a form has tagged event classes, it will not be tracked as a generic “Form: Submission”. Only the custom tagged event will fire.

Combined Features

Use a combined script to enable multiple features:
Available script variants:
  • script.js - Base tracker
  • script.file-downloads.js - With file download tracking
  • script.outbound-links.js - With outbound link tracking
  • script.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”).
For more details, see ecommerce revenue tracking.

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