PHP code example of levelweb / laravel-google-analytics-4-measurement-protocol

1. Go to this page and download the library: Download levelweb/laravel-google-analytics-4-measurement-protocol 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/ */

    

levelweb / laravel-google-analytics-4-measurement-protocol example snippets


GA4::postEvent([
    'name' => 'login',
    'params' => [
        'method' => 'Google',
    ],
]);
bash
php artisan vendor:publish --tag=google-analytics-4-measurement-protocol-config