Download the PHP package jakeydevs/analytics without Composer
On this page you can find all versions of the php package jakeydevs/analytics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jakeydevs/analytics
More information about jakeydevs/analytics
Files in jakeydevs/analytics
Package analytics
Short Description A self-hosted analytic system for Laravel
License MIT
Informations about the package analytics
Analytics
Analytics is a simple website analytic package for Laravel giving you just enough data to be practical without any of the data-sharing, third party crazyness you get with hosted web analytic tools.
This plugin is being actively developed on stream by https://www.twitch.tv/jakeydev.
Installation
System built on Laravel 8. Not tested on anything under version 8.
$ composer require jakeydevs/analytics
Once installed, run migrations to allow the system to record pageviews! To edit the configuration for the package, you can publish the config file to make edits:
php artisan vendor:publish --provider="Jakeydevs\Analytics\AnalyticServiceProvider" --tag="config"
Record Pageviews
Recorded Pageviews
To record pageviews, you'll need to add a specific middleware to your routes. This middleware, when ran, will save each pageview to the system. The middleware is named pageview
.
To save on all pageviews to your system set the middleware to run when the web routes are ran. The best way to do this is by setting the middleware on the RouteServiceProvider
app\Providers\RouteServiceProvider.php
Provided methods
Dates
Dates should be passed to the analytics model in as a Period
. Examples are:
You can also get a set of dates to compare to your period - useful for providing context to results - by using the compare method. Examples are
Analytic Methods
You can use these methods to get pageviews, unique sessions, the bounce rate or the average duration of time for a session (in seconds):
You can also get aggregated information for any of the parsed data gathered (browser, os, device, location, paths).
The data returned is an array with the column and sessions ordered high to low.
View Components
The system comes with several view components out the box for working with the data. They are based on Tailwind and the design can be found below.
You can use these with the tags:
FAQ
Is this GDPR comliant? I think so? I am not a lawyer - and if you are not either, you should totally talk to one if you are worried about GDPR.
Does this work on SPAs At the moment no as it only records a pageview on a page request.
Contributing
Contributions are welcome - please send a pull request. When the project matures we'll add more detailed contribution guidelines!
This repo is available as part of Hacktoberfest 2020 and is perfect for first timers! If you need help, please join me on streams on Tuesdays and Fridays between 1pm and 4pm (GMT)!
Features
Please feel free to add pull requests for any of the below crossed - or ask for new features in the issues.
✅ Record a pageview (Middleware) ✅ Get data from system ✅ Parsing configuration ❌ Record a pageview (manually - useful for SPA) ❌ View components for basic analytics ❌ Tests ❌ How to add own data parsers ❌ Example dashboard
License
MIT