Quick Start
Get up and running with Plausible Analytics in under 5 minutes.
Add your website
Sign up for a Plausible account and add your website domain.
Install the script
Add the Plausible script to your website's <head>
section.
<script defer data-domain="yourdomain.com" src="https://plausible.shop/js/script.js"></script>
Start tracking
Visit your website and check your Plausible dashboard to see the data flowing in.
Installation
Detailed installation instructions for different platforms and frameworks.
Standard Installation
For most websites, simply add this script tag to your HTML:
<script defer data-domain="yourdomain.com" src="https://plausible.shop/js/script.js"></script>
💡 Pro Tip
Replace yourdomain.com
with your actual domain name. The script should be placed in the <head>
section of your HTML.
React/Next.js
For React applications, you can use the official Plausible React hook:
npm install plausible-tracker
import { usePlausible } from 'next-plausible'
function MyApp() {
const plausible = usePlausible()
const handleClick = () => {
plausible('signup')
}
return <button onClick={handleClick}>Sign up</button>
}
Script Installation
Different script options for various use cases.
Standard Script
<script defer data-domain="yourdomain.com" src="https://plausible.shop/js/script.js"></script>
Script with Outbound Link Tracking
<script defer data-domain="yourdomain.com" src="https://plausible.shop/js/script.outbound-links.js"></script>
Script with Custom Events
<script defer data-domain="yourdomain.com" src="https://plausible.shop/js/script.manual.js"></script>
⚠️ Important
Only use one script per page. Choose the script that includes all the features you need.
Custom Events
Track custom events and conversions on your website.
Basic Event Tracking
// Track a simple event
plausible('signup')
// Track an event with custom properties
plausible('purchase', {
props: {
amount: 99.99,
currency: 'USD',
product: 'Pro Plan'
}
})
Goal Setup
Before tracking events, you need to set up goals in your Plausible dashboard:
- Go to your site settings
- Click on "Goals"
- Add a new custom event goal
- Enter the event name (e.g., "signup")
Stats API
Access your analytics data programmatically with the Stats API.
Authentication
All API requests require authentication using an API key:
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://plausible.shop/api/v1/stats/aggregate?site_id=yourdomain.com
Aggregate Stats
GET /api/v1/stats/aggregate?site_id=yourdomain.com&period=30d&metrics=visitors,pageviews
Response Example:
{
"results": {
"visitors": {
"value": 12345
},
"pageviews": {
"value": 45678
}
}
}
Time Series Data
GET /api/v1/stats/timeseries?site_id=yourdomain.com&period=7d&metrics=visitors
Self-hosting with Docker
Run Plausible on your own infrastructure using Docker.
Quick Start
# Clone the repository
git clone https://github.com/plausible/hosting
cd hosting
# Configure your settings
cp plausible-conf.env.example plausible-conf.env
# Edit plausible-conf.env with your settings
# Start the services
docker-compose up -d
Environment Variables
Variable | Description | Required |
---|---|---|
BASE_URL |
The base URL of your Plausible instance | Yes |
SECRET_KEY_BASE |
Secret key for encryption | Yes |
DATABASE_URL |
PostgreSQL database connection string | Yes |
Frequently Asked Questions
How accurate is Plausible compared to Google Analytics?
Plausible is very accurate and often shows higher numbers than Google Analytics because we don't use cookies and don't get blocked by ad blockers as much.
Can I import my Google Analytics data?
Yes, we provide an import tool that can bring in your historical Google Analytics data. This helps you maintain continuity when switching to Plausible.
Is Plausible GDPR compliant?
Yes, Plausible is fully GDPR compliant. We don't use cookies, don't collect personal data, and all data is processed in the EU.