$keyFileJson = 'service-account-credentials.json';
// Create and configure a new client object.
$report = new Report(
array(
'keyFileLocation' => $keyFileJson,
'applicationName' => 'Example Analytics Reporting'
)
);
// set date range with from and to dates.
$dateRange = $report->setDateRange('YYYY-MM-DD', 'YYYY-MM-DD');
// set metrics
$sessionsMetric = $report->setMetric("ga:sessions", "sessions");
// set dimensions
$operatingSystemDimension = $report->setDimension("ga:operatingSystem");
// generate reports object
$reports = $report->getReports(
"VIEW_ID",
$dateRange,
[$sessionsMetric],
[$countryDimension]
);
// get array with results
$results = $report->getResults($reports);
-
Notifications
You must be signed in to change notification settings - Fork 0
jorgemarcial/php-google-analytics-wrapper
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Php google analytics wrapper
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published