PHPackages                             mohammedshuaau/enhanced-analytics - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. mohammedshuaau/enhanced-analytics

ActiveStatamic-addon[Caching](/categories/caching)

mohammedshuaau/enhanced-analytics
=================================

A powerful, efficient analytics solution for Statamic with real-time tracking, caching, and comprehensive dashboard visualization.

v1.0.18(11mo ago)41.4k↓66.7%2[2 issues](https://github.com/mohammedshuaau/enhanced-analytics/issues)[1 PRs](https://github.com/mohammedshuaau/enhanced-analytics/pulls)PHPPHP ^8.3

Since Jan 12Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/mohammedshuaau/enhanced-analytics)[ Packagist](https://packagist.org/packages/mohammedshuaau/enhanced-analytics)[ RSS](/packages/mohammedshuaau-enhanced-analytics/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (20)Used By (0)

Enhanced Analytics for Statamic
===============================

[](#enhanced-analytics-for-statamic)

A powerful analytics addon for Statamic that provides detailed insights into your website's traffic and user behavior.

Features
--------

[](#features)

### 📊 Real-Time Analytics

[](#-real-time-analytics)

- Page view tracking with automatic data processing
- Unique visitor identification and session management
- Configurable processing frequency (default: every 15 minutes)
- Automatic data aggregation for efficient querying

### 👥 Visitor Insights

[](#-visitor-insights)

- Total visits and unique visitors
- New vs returning visitors
- Session duration and pages per session
- Bounce rate and exit rate analysis
- User flow tracking (entry pages, engaged pages, exit pages)

### 🌍 Geographic Data

[](#-geographic-data)

- IP-based geolocation using ip-api.com
- Country and city-level tracking
- Built-in rate limiting (45 requests/minute)
- Automatic caching of geolocation data
- Configurable cache duration

### 💻 Technical Insights

[](#-technical-insights)

- Device type tracking (desktop, mobile, tablet)
- Browser and platform detection
- Referrer URL tracking
- User agent analysis

### ⚡ Performance Features

[](#-performance-features)

- Efficient data caching system
- Support for file caching
- Automatic cleanup of old data
- Chunk-based processing to prevent memory issues
- Lock system to prevent concurrent processing

### 🎨 Dashboard Features

[](#-dashboard-features)

- Clean, modern interface with dark mode support
- Polled data refresh
- Customizable date ranges (24h, 7d, 30d, custom)
- Comparative metrics with previous periods
- Export functionality for detailed analysis
- Interactive charts and visualizations

### 🔒 Privacy &amp; Security

[](#-privacy--security)

- Built-in consent management system (disabled by default)
- No external service dependencies
- Complete data ownership
- Configurable IP address exclusions
- Bot filtering
- Authenticated user tracking options
- Granular consent controls for visitors
- Optional geolocation tracking toggle

Installation
------------

[](#installation)

1. Install the package via Composer:

```
composer require mohammedshuaau/enhanced-analytics
```

2. Publish the configuration:

```
php artisan vendor:publish --tag=enhanced-analytics-config
```

3. Run the migrations:

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

The addon can be configured via the `config/enhanced-analytics.php` file:

```
return [
    'cache' => [
        'driver' => 'file', // Options: 'file', 'redis'
        'file' => [
            'path' => storage_path('app/enhanced-analytics'),
            'permissions' => [
                'file' => 0644,
                'directory' => 0755
            ]
        ]
    ],

    'geolocation' => [
        'cache_duration' => 1440, // 24 hours
        'rate_limit' => 45 // requests per minute
    ],

    'processing' => [
        'frequency' => 15, // minutes
        'chunk_size' => 1000,
        'lock_timeout' => 60
    ],

    'tracking' => [
        'exclude_paths' => [
            'cp/*',
            'api/*'
        ],
        'exclude_ips' => [],
        'exclude_bots' => true,
        'track_authenticated_users' => true,
        'consent' => [
            'enabled' => false, // Set to true to enable consent banner
            'banner' => [
                'title' => 'Privacy Notice',
                'description' => 'We use analytics to understand how you use our website and improve your experience.',
                'accept_button' => 'Accept',
                'decline_button' => 'Decline',
                'settings_button' => 'Customize',
                'position' => 'bottom', // options: bottom, top, center
            ],
        ],
    ]
];
```

### Consent Banner Configuration

[](#consent-banner-configuration)

The addon includes a privacy-focused consent banner that's disabled by default. Here's how to configure it:

1. Enable the consent banner by setting `tracking.consent.enabled` to `true` in your config file.
2. Add the consent banner and CSRF token (header meta tag) to your layout:

```
{{ enhanced_analytics:consent_banner }}
```

```

```

3. Customize the banner appearance and text:

```
'consent' => [
    'enabled' => true,
    'banner' => [
        'title' => 'Your Custom Title',
        'description' => 'Your custom description about tracking.',
        'accept_button' => 'Allow Tracking',
        'decline_button' => 'No Thanks',
        'settings_button' => 'Preferences',
        'position' => 'bottom', // Available options: bottom, top, center
    ],
],
```

### Customizing the Consent Banner Template

[](#customizing-the-consent-banner-template)

You can fully customize the consent banner's appearance by publishing and editing its template:

1. Publish the consent banner template:

```
php artisan vendor:publish --tag="enhanced-analytics-views"
```

2. Edit the template at:

```
resources/views/vendor/enhanced-analytics/components/consent-banner.antlers.html

```

The template uses Alpine.js for interactivity and Tailwind CSS for styling. You can modify the HTML structure, styling, and behavior while maintaining the core functionality through the following data attributes:

- `x-data="consentBanner"`: The main component
- `x-model="settings.geolocation"`: Geolocation toggle binding
- `x-on:click="accept"`: Accept button action
- `x-on:click="decline"`: Decline button action
- `x-on:click="toggleSettings"`: Settings toggle action

The consent banner includes:

- Essential analytics toggle (always enabled)
- Optional geolocation tracking toggle
- Persistent settings through session storage
- Responsive design with dark mode support

When enabled, tracking will only begin after the visitor provides consent. Their preferences are saved and respected across sessions.

Usage
-----

[](#usage)

Once installed, the addon will automatically start tracking page visits. Access the analytics dashboard via the Control Panel under Tools &gt; Analytics.

### Automatic Processing

[](#automatic-processing)

The addon automatically processes analytics data via Scheduler. You might want to run the scheduler and the addon will handle the rest. You can always set the minutes the command should execute.

### Manual Processing

[](#manual-processing)

You can manually process analytics data using the command:

```
php artisan analytics:process
```

### Data Export

[](#data-export)

Export detailed analytics data directly from the dashboard in CSV format for further analysis.

Performance Considerations
--------------------------

[](#performance-considerations)

- The addon uses efficient caching and processes data in chunks to maintain performance
- Geolocation data is cached to respect API rate limits
- Database queries are optimized using aggregates for faster dashboard loading
- Automatic cleanup of old cache data

### Upcoming Features

[](#upcoming-features)

- Support for Redis Driver

Contributing
------------

[](#contributing)

Contributions are always welcome!

### Development Guidelines

[](#development-guidelines)

- Follow PSR-12 coding standards
- Add appropriate comments and documentation
- Update the README.md with details of significant changes
- Add/update tests as needed
- Ensure all tests pass before submitting PR

### Testing

[](#testing)

Run the test suite:

```
vendor/bin/phpunit
```

Support
-------

[](#support)

If you discover any security-related issues, please use the issue tracker to report them.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance42

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity62

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~9 days

Recently: every ~0 days

Total

19

Last Release

332d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.0.1PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/165899172?v=4)[Mohamed Shuaau](/maintainers/mohammedshuaau)[@mohammedshuaau](https://github.com/mohammedshuaau)

---

Tags

performancereal-timetrackingcachedashboardanalyticschartchartjsstatamicalpinejsEnhancedStatamic addonenhanced-analytics

### Embed Badge

![Health badge](/badges/mohammedshuaau-enhanced-analytics/health.svg)

```
[![Health](https://phpackages.com/badges/mohammedshuaau-enhanced-analytics/health.svg)](https://phpackages.com/packages/mohammedshuaau-enhanced-analytics)
```

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[putyourlightson/craft-blitz

Intelligent static page caching for creating lightning-fast sites.

153471.5k29](/packages/putyourlightson-craft-blitz)[muhammadsadeeq/laravel-activitylog-ui

A beautiful, modern UI for Spatie's Activity Log with advanced filtering, analytics, and real-time features.

17510.1k](/packages/muhammadsadeeq-laravel-activitylog-ui)[anahkiasen/flatten

A package for the Illuminate framework that flattens pages to plain HTML

33113.0k](/packages/anahkiasen-flatten)[rarst/fragment-cache

WordPress plugin for partial and async caching of heavy front-end elements.

14115.0k2](/packages/rarst-fragment-cache)[silverstripe/staticpublishqueue

Static publishing queue to create static versions of pages for enhanced performance and security

45135.4k4](/packages/silverstripe-staticpublishqueue)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
