Skip to main content

Attach custom properties to pageviews

Add your custom properties to your Plausible snippet​

You can add custom properties by updating your Plausible snippet.

To add properties that attach to every tracked event, update the plausible.init call to pass customProperties option:

plausible.init({
// ... Other initialization options
customProperties: {
author: "John Doe",
type: "blog-post"
}
})

You're now tracking custom properties alongside pageviews.

Advanced: Dynamically setting custom properties​

To include dynamic data for custom properties, set customProperties to be a function. This function will be called for every event.

For example:

plausible.init({
// ... Other initialization options
customProperties: function(eventName) {
if (eventName == "pageview") {
return {
author: "John Doe",
title: document.title
}
}

return {}
}
})

Ready to ditch Google Analytics?

Start your free trial today