Plausible Analytics Setup#
This guide explains how to set up and configure Plausible analytics in Iaso.
Overview#
Iaso supports Plausible analytics integration for tracking user activity and account usage. The system automatically generates analytics scripts and tracks custom events with user and account information.
Analytics Levels#
The system provides different levels of analytics tracking:
- Basic Tracking: Page views for all users (domain only)
- Enhanced Tracking: Custom events with user/account data for authenticated users
- Future: Custom analytics scripts for specific customer requirements
Prerequisites#
- A Plausible account and subscription
- Access to your Iaso instance
- Domain name for your Iaso instance
Step 1: Enable Analytics#
Environment Variable#
Add the following environment variable to enable analytics:
ENABLE_ANALYTICS=true
Docker Compose:
# docker-compose.yml
services:
iaso:
environment:
ENABLE_ANALYTICS: "true"
Environment File:
# .env
ENABLE_ANALYTICS=true
Step 2: Add Your Domain to Plausible#
- Log into your Plausible dashboard
- Add a new site with your Iaso domain
- Enter your domain (e.g.,
your-iaso-instance.com
) - Save the site
Step 3: Configure Custom Properties#
To see user and account data in your Plausible dashboard, you need to add custom properties:
Required Custom Properties#
Property Name | Type | Description |
---|---|---|
username |
String | User's username |
user_id |
Number | User's unique ID |
account_name |
String | Account/organization name |
account_id |
Number | Account's unique ID |
How to Add Custom Properties#
- Go to your site in Plausible
- Navigate to Settings → Custom Properties
- Click "Add custom property"
- Enter the property details:
- Name:
username
- Repeat for all properties
- Save each property
Step 4: Verify Setup#
Check Analytics Script#
- Enable analytics:
ENABLE_ANALYTICS=true
- Access your Iaso instance
- Log in as a user
- Open browser developer tools
- Check the page source for the Plausible script:
```html
```
Check Network Requests#
- Open browser developer tools
- Go to Network tab
- Refresh the page
- Look for requests to
plausible.io
- Verify custom events are being sent
Step 5: View Analytics Data#
Custom Events#
In your Plausible dashboard, you'll see:
- Event Name: "User Login"
- Properties: All user and account details
- Timing: When users log in and access pages
Dashboard Views#
You can create custom views to analyze:
- User Activity: Most active users
- Account Usage: Usage per account/organization
- Feature Usage: Which features are used most
- User Journeys: Individual user behavior patterns
Plausible Filters and Iaso Pages#
Iaso supports creating pages with raw HTML, Superset dashboards, or embedded Plausible dashboards. You can use Plausible's filtering capabilities to create targeted analytics views.
Filtering by User Properties#
Plausible allows filtering results using URL parameters. You can create Iaso pages that show filtered analytics data:
Filter for Non-Connected Pages#
To show only analytics for non-authenticated users (pages without user data):
https://plausible.io/your-domain.com?f=is,props:username,(none)
Filter by Account#
To show analytics for a specific account:
https://plausible.io/your-domain.com?f=is,props:account_id,123
Filter by Username#
To show analytics for a specific user:
https://plausible.io/your-domain.com?f=is,props:username,john_doe
Creating Iaso Pages with Filtered Analytics#
1. Raw HTML Page#
Create a page with embedded Plausible dashboard:
<iframe
src="https://plausible.io/your-domain.com?f=is,props:account_id,123"
width="100%"
height="600px"
frameborder="0">
</iframe>
2. Plausible Dashboard Page#
Create a dedicated analytics page:
<!-- Full analytics dashboard -->
<iframe
src="https://plausible.io/your-domain.com?f=is,props:username,(none)&period=30d"
width="100%"
height="800px">
</iframe>
Common Filter Patterns#
Account-Specific Dashboards#
# Dashboard for specific account
https://plausible.io/your-domain.com?f=is,props:account_id,678&period=30d
# Dashboard for account by name
https://plausible.io/your-domain.com?f=is,props:account_name,WHO%20Country%20Office
User-Specific Views#
# Analytics for specific user
https://plausible.io/your-domain.com?f=is,props:username,john_doe&period=7d
# Analytics for users in specific account
https://plausible.io/your-domain.com?f=is,props:account_id,678&f=is,props:username,(not%20none)
Anonymous vs Authenticated Users#
# Only anonymous users (non-connected pages)
https://plausible.io/your-domain.com?f=is,props:username,(none)
# Only authenticated users
https://plausible.io/your-domain.com?f=is,props:username,(not%20none)
Filter URL Parameters#
Parameter | Description | Example |
---|---|---|
f=is,props:username,(none) |
Filter for anonymous users | Non-connected pages |
f=is,props:account_id,123 |
Filter by account ID | Account-specific dashboard |
f=is,props:account_name,WHO |
Filter by account name | Organization dashboard |
f=is,props:user_id,456 |
Filter by user ID | User-specific analytics |
period=30d |
Time period | Last 30 days |
period=7d |
Time period | Last 7 days |
period=1m |
Time period | Last month |
Creating Multi-Account Dashboards#
For organizations managing multiple accounts, you can create comparison dashboards:
<!-- Compare multiple accounts -->
<iframe
src="https://plausible.io/your-domain.com?f=is,props:account_id,123&f=is,props:account_id,456&period=30d"
width="100%"
height="600px">
</iframe>
Using Plausible Dashboards in Iaso Pages#
To create analytics dashboards in Iaso pages, use the iframe option with a specific Plausible URL:
<iframe
src="https://plausible.io/your-domain.com?f=is,props:account_id,123&period=30d"
width="100%"
height="600px"
frameborder="0">
</iframe>
This allows you to embed filtered Plausible analytics directly into your Iaso pages.
Configuration Options#
Environment Variables#
Variable | Default | Description |
---|---|---|
ENABLE_ANALYTICS |
true |
Enable/disable analytics globally |
Analytics Data Tracked#
Page Views#
- All page visits are automatically tracked
- Domain is automatically detected from the request
Custom Events (Authenticated Users Only)#
- Event: "User Login"
- Properties:
username
: User's usernameuser_id
: User's unique IDaccount_name
: Account/organization nameaccount_id
: Account's unique ID
Non-Connected Pages#
For pages without user authentication (embeddable pages, public pages, etc.): - Only domain tracking: Basic page views are tracked - No user data: No custom events or user properties - Privacy-focused: Minimal data collection for anonymous users
Privacy and Security#
Data Privacy#
- No PII: Usernames are typically not personally identifiable
- Account Level: Focuses on organizational usage patterns
- GDPR Compliant: Plausible is privacy-focused by design
- No Cookies: Plausible doesn't use cookies
Security Considerations#
- HTTPS Only: Analytics only works over HTTPS in production
- Domain Validation: Only tracks on the configured domain
- User Consent: Consider implementing user consent if required
Troubleshooting#
Analytics Not Working#
-
Check environment variable:
bash echo $ENABLE_ANALYTICS
-
Verify domain in Plausible:
- Ensure your domain is added to Plausible
-
Check for typos in the domain name
-
Check browser console:
- Look for JavaScript errors
-
Verify Plausible script is loading
-
Check network requests:
- Ensure requests to
plausible.io
are not blocked (i.e. by your ad blocker) - Check for CORS issues
Custom Properties Not Showing#
- Verify property names: Must match exactly (case-sensitive)
- Check property types: Ensure correct data types
- Wait for data: Custom properties may take time to appear
- Check event data: Verify events are being sent with properties
Development Testing#
For local development:
-
Use a test domain:
bash # In /etc/hosts 127.0.0.1 test-iaso.local
-
Add test domain to Plausible:
-
Add
test-iaso.local
as a site in Plausible -
Enable analytics locally:
bash ENABLE_ANALYTICS=true
-
Access via test domain:
http://test-iaso.local:8081
Advanced Configuration#
Custom Event Tracking#
You can extend the analytics system to track additional events:
// Example: Track feature usage
window.plausible('Feature Used', {
props: {
feature: 'data_export',
username: 'user123',
account_name: 'WHO'
}
});
Multiple Analytics Providers#
The system is designed to support multiple analytics providers. Future versions may include:
- Google Analytics
- Matomo
- Custom analytics solutions
Custom Analytics Scripts (Future Feature)#
The analytics_script
field in the Account model is preserved for future use:
- Current: Not used in the new analytics system
- Future: Will allow customers to specify custom analytics scripts
- Implementation: Will be added in a future version
- Use Case: For customers who need specific analytics providers or configurations
Note: The current system uses automatic Plausible script generation. Custom scripts will be implemented as an additional feature.
Support#
For issues with:
- Iaso Analytics Integration: Check this documentation
- Plausible Service: Contact Plausible support
- Custom Properties: Refer to Plausible documentation