PHP code example of mohammedshuaau / enhanced-analytics

1. Go to this page and download the library: Download mohammedshuaau/enhanced-analytics library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mohammedshuaau / enhanced-analytics example snippets


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' => [
    '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
    ],
],
bash
php artisan vendor:publish --tag=enhanced-analytics-config
bash
php artisan migrate
bash
php artisan vendor:publish --tag="enhanced-analytics-views"
bash
php artisan analytics:process