mirror of
https://github.com/mohitmishra786/amILearningEnough.git
synced 2025-12-16 20:07:07 +03:00
2.8 KiB
2.8 KiB
GoatCounter Analytics Integration
This MkDocs site is now integrated with GoatCounter for privacy-friendly analytics tracking.
What's Been Set Up
1. Tracking Script
- The GoatCounter tracking script is automatically loaded on all pages
- Your tracking code:
https://learningresource.goatcounter.com/count
2. Analytics Display
- Homepage: Shows a total site view counter and link to public dashboard
- All Pages: Each page displays an analytics widget at the bottom with:
- Link to view detailed dashboard
- Expandable section showing page-specific view counter (when available)
3. Configuration
The GoatCounter integration is configured in mkdocs.yml:
extra:
goatcounter:
site: learningresource
domain: learningresource.goatcounter.com
How to Use
View Analytics Dashboard
- Go to https://learningresource.goatcounter.com/
- View real-time statistics including:
- Page views per page
- Total site views
- Visitor locations (anonymized)
- Browser and device statistics
- Referrer information
Enable Public Statistics Display (Optional)
If you want to show individual page view counters publicly:
- Go to your GoatCounter settings
- Enable "Public statistics"
- The page-specific counters will automatically start working
Customize Analytics Display
- Edit
docs/overrides/main.htmlto modify the analytics widget - Edit
docs/overrides/stylesheets/goatcounter.cssto change styling - Modify
docs/index.mdto adjust the homepage analytics section
Files Created/Modified
mkdocs.yml # Added GoatCounter config
docs/overrides/main.html # Custom template with analytics
docs/overrides/stylesheets/goatcounter.css # Analytics styling
docs/index.md # Added analytics section
Privacy Features
GoatCounter is designed with privacy in mind:
- ✅ No cookies
- ✅ No tracking across sites
- ✅ No personal data collection
- ✅ Respects Do Not Track
- ✅ GDPR compliant
- ✅ Open source
Testing
To test the integration:
- Build and serve your site:
mkdocs serve - Visit different pages
- Check the GoatCounter dashboard to see if visits are being tracked
- Verify the analytics widgets appear on each page
Troubleshooting
Visits not being tracked?
- Check that the GoatCounter script loads without errors in browser dev tools
- Verify your GoatCounter site URL is correct
- Ensure JavaScript is enabled
Analytics widgets not appearing?
- Check that the custom theme directory is being used
- Verify the
custom_dir: overridessetting in mkdocs.yml - Make sure the CSS file path is correct
Public counters not working?
- Enable public statistics in your GoatCounter settings
- Wait a few minutes for the setting to take effect