Package Data | |
---|---|
Maintainer Username: | JayBizzle |
Maintainer Contact: | max@kingkreations.co.uk (Max King) |
Package Create Date: | 2016-06-28 |
Package Last Update: | 2023-02-02 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-09-04 15:06:15 |
Package Statistics | |
---|---|
Total Downloads: | 35,459 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 7 |
Total Watchers: | 3 |
Total Forks: | 2 |
Total Open Issues: | 1 |
Port of Laravel 4 bundle thujohn/analytics for Laravel 5
Add m2quared/laravel-google-analytics
to composer.json
.
"m2quared/laravel-google-analytics": "^1.0"
Run composer update
to pull down the latest release of Laravel Google Analytics.
Now open up config/app.php
and add the service provider to your providers
array.
'providers' => [
M2quared\Analytics\AnalyticsServiceProvider::class,
]
Now add the alias.
'aliases' => [
'Analytics' => M2quared\Analytics\AnalyticsFacade::class,
]
Run php artisan vendor:publish
and modify the config file config/google-analytics.php
with your own information.
Querying the API for visits and pageviews in the last week.
More information about this calling the Google Analytics API can be found here https://developers.google.com/apis-explorer/#s/analytics/v3/analytics.data.ga.get
A list of all Google Analytics metrics can be found here https://developers.google.com/analytics/devguides/reporting/core/dimsmets
$site_id = Analytics::getSiteIdByUrl('http://github.com/'); // return something like 'ga:11111111'
$stats = Analytics::query($site_id, '7daysAgo', 'yesterday', 'ga:visits,ga:pageviews');