5.1 KiB
Cloudflare Web Analytics Extension
A Paymenter extension that integrates Cloudflare Web Analytics to track visitor metrics, page views, and performance data across your Paymenter installation.
Features
- Automatic Tracking: Tracks all page views across your entire Paymenter installation
- Privacy-Friendly: Cloudflare Web Analytics is cookie-free and respects user privacy
- Performance Metrics: Monitor Core Web Vitals and page load times
- Visitor Insights: Track unique visitors, page views, referrers, and more
- Easy Setup: Simple configuration through the Paymenter admin panel
Installation
-
Copy Extension Files
Place the
CloudflareAnalyticsfolder in your Paymenter installation:/var/www/paymenter/extensions/Others/CloudflareAnalytics/ -
Register Extension
Run the following commands to register the extension:
composer dump-autoload php artisan cache:clear -
Install Extension in Admin Panel
- Navigate to your Paymenter admin panel
- Go to Extensions → Others
- Click the Install Extension button
- Select CloudflareAnalytics from the list
- Click Install
Configuration
1. Get Your Cloudflare Beacon Token
- Log in to your Cloudflare Dashboard
- Navigate to Analytics & Logs → Web Analytics
- Click Add a site or select an existing site
- Copy your Beacon Token (it looks like:
abc123def456...)
2. Configure the Extension
- In your Paymenter admin panel, go to Extensions → Others
- Find CloudflareAnalytics and click Edit
- Enable the extension by toggling the Enabled switch
- Paste your Beacon Token in the configuration field
- Click Save
What Gets Tracked
Once enabled, Cloudflare Web Analytics automatically tracks:
- Page Views: Total number of pages viewed
- Unique Visitors: Number of unique visitors to your site
- Top Pages: Most visited pages on your Paymenter installation
- Referrers: Where your visitors are coming from
- Countries: Geographic distribution of your visitors
- Devices: Desktop vs Mobile traffic
- Browsers: Browser usage statistics
- Core Web Vitals: Performance metrics (LCP, FID, CLS)
Viewing Analytics
After installation and configuration:
- Visit your Cloudflare Dashboard
- Go to Analytics & Logs → Web Analytics
- Select your site to view detailed analytics
- Data typically appears within a few minutes of the first visit
Technical Details
How It Works
The extension injects the Cloudflare Web Analytics beacon script into the <head> section of every page on your Paymenter installation:
<!-- Cloudflare Web Analytics -->
<script defer src='https://static.cloudflareinsights.com/beacon.min.js'
data-cf-beacon='{"token": "your_token_here"}'></script>
<!-- End Cloudflare Web Analytics -->
Files Structure
CloudflareAnalytics/
├── CloudflareAnalytics.php # Main extension class
├── README.md # This file
└── resources/
└── views/
└── script.blade.php # Analytics script template
Extension Metadata
- Name: Cloudflare Web Analytics
- Version: 1.0.0
- Author: Onyx
- Author URL: https://builtbybit.com/members/onyxdigital.600543/
Privacy & GDPR Compliance
Cloudflare Web Analytics is designed with privacy in mind:
- Cookie-free: No cookies are set on visitors' browsers
- No personal data collection: Does not collect personally identifiable information
- GDPR compliant: Respects user privacy and complies with GDPR requirements
- No fingerprinting: Does not use device fingerprinting techniques
Troubleshooting
Extension doesn't appear in the list
- Make sure files are in the correct location:
extensions/Others/CloudflareAnalytics/ - Run
composer dump-autoloadandphp artisan cache:clear - Refresh your browser and check again
Script not appearing on pages
- Verify the extension is enabled in the admin panel
- Make sure you've entered a valid Beacon Token
- Clear browser cache and check page source (right-click → View Page Source)
- Search for "cloudflare" or "beacon.min.js" in the HTML
No data in Cloudflare Dashboard
- Wait a few minutes - data can take time to appear
- Visit your Paymenter site to generate some traffic
- Verify the beacon token is correct
- Check that the script is loading without errors (F12 → Console)
Support
For support or questions about this extension:
- Author: Onyx
- Profile: https://builtbybit.com/members/onyxdigital.600543/
For Cloudflare Web Analytics support:
- Cloudflare Docs: https://developers.cloudflare.com/analytics/web-analytics/
- Cloudflare Support: https://support.cloudflare.com/
License
This extension is provided as-is for use with Paymenter installations.
Changelog
Version 1.0.0
- Initial release
- Cloudflare Web Analytics integration
- Admin panel configuration
- Automatic script injection on all pages