PHP code example of m2quared / laravel-google-analytics
1. Go to this page and download the library: Download m2quared/laravel-google-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/ */
m2quared / laravel-google-analytics example snippets
'providers' => [
M2quared\Analytics\AnalyticsServiceProvider::class,
]
'aliases' => [
'Analytics' => M2quared\Analytics\AnalyticsFacade::class,
]
$site_id = Analytics::getSiteIdByUrl('http://github.com/'); // return something like 'ga:11111111'
$stats = Analytics::query($site_id, '7daysAgo', 'yesterday', 'ga:visits,ga:pageviews');