PHP code example of reactmore-tech / google-analytics
1. Go to this page and download the library: Download reactmore-tech/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/ */
reactmore-tech / google-analytics example snippets
composer
service('GoogleAnalytics');
$GA = service('GoogleAnalytics');
$Analytics = new Analytics();
echo '<pre>';
$GA->Fetching()->fetchTopBrowsers(PeriodTime::days(10)) //Result Array
echo '</pre>';
// Method
$Analytics = new Analytics();
// Fetch Users and New Users
$GA->Fetching()->fetchUserTypes(Period::days(7));
// Get Data Top Browser used visitor
$GA->Fetching()->fetchTopBrowsers(Period::days(7));
// Get Data Refferer Page
$GA->Fetching()->fetchTopReferrers(Period::days(7));
// Populer Pages
$GA->Fetching()->fetchMostVisitedPages(Period::days(7));
// Get Visitor and Pageviews
$GA->Fetching()->fetchTotalVisitorsAndPageViews(Period::days(7));