Download the PHP package spatie/analytics-reports without Composer
On this page you can find all versions of the php package spatie/analytics-reports. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package analytics-reports
🚨 THIS PACKAGE HAS BEEN ABANDONED 🚨
We don't use this package anymore in our own projects and cannot justify the time needed to maintain it anymore. That's why we have chosen to abandon it. Feel free to fork our code and maintain your own copy.
Retrieve data from Google Analytics
This is an opinionated Laravel 4 package to retrieve Google Analytics data.
If you're using Laravel 5, take a look at this package.
Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
Postcardware
You're free to use this package (it's MIT-licensed), but if it makes it to your production environment you are required to send us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.
The best postcards will get published on the open source page on our website.
Installation
This package can be installed through Composer.
You must install this service provider.
This package also comes with a facade, which provides an easy way to call the the class.
Although the composer.json of this package specifies that "google/apiclient" AND "thujohn/analytics" must be pulled in as well, it sometimes fails to do so. If you encouter this problem as well include these lines in your composer.json as well:
You can publish the config file of the package using artisan
After the config file has been published you'll manually have to move it to your app's config-folder. (Hopefully this step won't be necessary in a next version)
To move the config file copy the file from
and paste it to your folder and rename it to
In the config file you can specify two values:
- siteId: the Google site id, something in the form of ga:xxxxxxxx
- cacheLifeTime: the amount of minutes the Google API responses will be cached. If you set this value to zero, the responses won't be cached at all.
Internally this package uses thujohn/analytics-l4 to authenticate with Google. So in order to use this package you must also follow their installation instructions.
Usage
When the installation is done you can easily retrieve Analytics data. Mostly all methods will return an Illuminate\Support\Collection
-instance.
Here is an example to retrieve visitors and pageview data for the last seven days.
Here's another example to get the 20 most visited pages of the last 365 days
Provided methods
Visitors and Pageviews
These methods return a Collection with columns "date", "vistors" and "pageViews". When grouping by yearMonth, the first column will be called "yearMonth".
Keywords
These methods return a Collection with columns "keyword" and "sessions".
Referrers
These methods return a Collection with columns "url" and "pageViews".
Browsers
These methods return a Collection with columns "browser" and "sessions".
If there are more used browsers than the number specified in maxResults, then a new resultrow with browser-name "other" will be appended with a sum of all the remaining browsers.
Most visited pages
These methods return a Collection with columns "url" and "pageViews".
All other Google Analytics Queries
To perform all other GA queries use . Google's Core Reporting API provides more information on on which metrics and dimensions might be used.
Convenience methods
can be used to get the site id for the given url
About Spatie
Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
All versions of analytics-reports with dependencies
illuminate/support Version 4.*|5.*
google/apiclient Version 1.1.*
thujohn/analytics Version ^1.0