Deploying Prisme Analytics
Introduction
Prisme Analytics is a privacy-focused, open-source web analytics platform designed to give you meaningful insights about your website visitors without tracking personal data or using cookies. It provides a lightweight alternative to Google Analytics that respects user privacy while still delivering actionable metrics.
Built with performance in mind, Prisme’s tracking script is minimal and doesn’t slow down your website. The platform focuses on essential metrics that matter for understanding your audience without the complexity of enterprise analytics tools.
Key highlights of Prisme Analytics:
- Privacy First: No cookies, no personal data collection, GDPR compliant by design
- Lightweight Script: Minimal impact on page load times
- Real-Time Analytics: See visitor activity as it happens
- Essential Metrics: Page views, unique visitors, referrers, and more
- Simple Dashboard: Clean interface focused on actionable insights
- Self-Hosted: Complete control over your analytics data
- API Access: Programmatic access to your analytics data
- Open Source: Transparent codebase you can audit and modify
This guide walks through deploying Prisme Analytics on Klutch.sh using Docker.
Why Deploy Prisme Analytics on Klutch.sh
Deploying Prisme Analytics on Klutch.sh provides several advantages:
Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds Prisme Analytics without complex configuration.
Persistent Storage: Attach persistent volumes for your analytics database.
HTTPS by Default: Klutch.sh provides automatic SSL certificates, essential for analytics collection.
GitHub Integration: Connect your repository directly from GitHub for automatic deployments.
Custom Domains: Assign a custom domain for your analytics dashboard.
Always-On Availability: Your analytics platform remains accessible 24/7 for continuous data collection.
Prerequisites
Before deploying Prisme Analytics on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your Prisme configuration
- Basic familiarity with Docker and containerization concepts
- A website where you want to install the tracking script
- (Optional) A custom domain for your Prisme Analytics instance
Understanding Prisme Analytics Architecture
Prisme Analytics consists of:
Tracking Script: A lightweight JavaScript snippet that collects page view data.
Collection API: Receives events from the tracking script and stores them.
Dashboard: Web interface for viewing analytics data.
Database: Stores all analytics events and aggregated metrics.
Preparing Your Repository
Create a GitHub repository containing your Dockerfile for Prisme Analytics deployment.
Repository Structure
prisme-deploy/├── Dockerfile└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM prismeanalytics/prisme:latest
# Set environment variablesENV PRISME_DATABASE_URL=${DATABASE_URL}ENV PRISME_SECRET_KEY=${SECRET_KEY}ENV PRISME_BASE_URL=${BASE_URL}
# Create data directoryRUN mkdir -p /data
EXPOSE 8000
CMD ["prisme", "serve"]Alternative Dockerfile with SQLite
For simpler deployments using SQLite:
FROM prismeanalytics/prisme:latest
# Set environment variablesENV PRISME_DATABASE_URL=sqlite:///data/prisme.dbENV PRISME_SECRET_KEY=${SECRET_KEY}ENV PRISME_BASE_URL=${BASE_URL}
# Create data directoryRUN mkdir -p /data
VOLUME ["/data"]
EXPOSE 8000
CMD ["prisme", "serve"]Creating the .dockerignore File
Create a .dockerignore file:
.git.github*.mdLICENSE.gitignore*.log.DS_Store.envDeploying Prisme Analytics on Klutch.sh
- Select HTTP as the traffic type
- Set the internal port to 8000
- Detect your Dockerfile automatically
- Build the container image
- Attach the persistent volumes
- Start the Prisme Analytics container
- Provision an HTTPS certificate
Generate a Secret Key
Generate a secure secret key for Prisme Analytics:
openssl rand -hex 32Save this key securely for the environment variables configuration.
Push Your Repository to GitHub
Initialize your repository and push to GitHub:
git initgit add Dockerfile .dockerignoregit commit -m "Initial Prisme Analytics deployment configuration"git remote add origin https://github.com/yourusername/prisme-deploy.gitgit push -u origin mainCreate a New Project on Klutch.sh
Navigate to the Klutch.sh dashboard and create a new project. Give it a descriptive name like “prisme” or “analytics”.
Create a New App
Within your project, create a new app. Connect your GitHub account if you haven’t already, then select the repository containing your Prisme Analytics Dockerfile.
Configure HTTP Traffic
In the deployment settings:
Set Environment Variables
Add the following environment variables:
| Variable | Value |
|---|---|
SECRET_KEY | Your generated secret key |
BASE_URL | https://your-app-name.klutch.sh |
DATABASE_URL | sqlite:///data/prisme.db (or PostgreSQL URL) |
Attach Persistent Volumes
Add the following volumes:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/data | 10 GB | Analytics database |
Deploy Your Application
Click Deploy to start the build process. Klutch.sh will:
Access Prisme Analytics
Once deployment completes, access your Prisme Analytics dashboard at https://your-app-name.klutch.sh. Create your admin account and add your first website.
Adding the Tracking Script
Installing on Your Website
After creating a site in Prisme Analytics, add the tracking script to your website:
<script defer src="https://your-analytics-domain.klutch.sh/js/script.js" data-site="your-site-id"></script>Framework-Specific Installation
Next.js:
// In _app.js or layout.jsimport Script from 'next/script'
export default function App({ Component, pageProps }) { return ( <> <Script defer src="https://your-analytics-domain.klutch.sh/js/script.js" data-site="your-site-id" /> <Component {...pageProps} /> </> )}Gatsby:
// In gatsby-browser.jsexport const onClientEntry = () => { const script = document.createElement('script') script.defer = true script.src = 'https://your-analytics-domain.klutch.sh/js/script.js' script.dataset.site = 'your-site-id' document.head.appendChild(script)}WordPress: Add the script to your theme’s header.php or use a header scripts plugin.
Understanding the Dashboard
Key Metrics
| Metric | Description |
|---|---|
| Unique Visitors | Distinct visitors based on daily aggregation |
| Total Pageviews | All page loads across your site |
| Bounce Rate | Visitors who left after viewing one page |
| Session Duration | Average time spent on your site |
Traffic Sources
- Direct: Visitors who typed your URL directly
- Referrers: Links from other websites
- Search Engines: Traffic from organic search
- Social Media: Links from social platforms
Geographic Data
View visitor locations by country and region without tracking individual IP addresses.
API Access
Prisme Analytics provides an API for programmatic access:
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://your-analytics-domain.klutch.sh/api/v1/stats?site_id=your-site-idPrivacy Compliance
Prisme Analytics is designed for privacy compliance:
- No Cookies: Works without setting any cookies
- No Personal Data: Doesn’t collect IP addresses or fingerprints
- GDPR Compliant: No consent banner needed
- Data Ownership: All data stays on your server
Troubleshooting Common Issues
Tracking Script Not Loading
Solutions:
- Verify the script URL is correct
- Check for ad blockers or privacy extensions
- Ensure HTTPS is working correctly
- Check browser console for errors
Data Not Appearing
Solutions:
- Wait a few minutes for data processing
- Verify the site ID matches your configuration
- Check that the script is on all pages
- Review server logs for errors
Dashboard Not Loading
Solutions:
- Verify the deployment is running
- Check database connectivity
- Review application logs
Additional Resources
- Prisme Analytics Website
- Prisme Analytics GitHub Repository
- Klutch.sh Persistent Volumes
- Klutch.sh Deployments
Conclusion
Deploying Prisme Analytics on Klutch.sh gives you a privacy-respecting analytics solution that provides meaningful insights without compromising visitor privacy. With automatic HTTPS, persistent storage, and easy deployment, you can start collecting analytics data quickly while maintaining complete control over your data.
Whether you’re running a personal blog or a business website, Prisme Analytics provides the essential metrics you need without the privacy concerns of traditional analytics platforms.