Permalink
Browse files

Upgrade Spatie Laravel Analytics package to latest version

  • Loading branch information...
bpocallaghan committed Oct 26, 2017
1 parent 614b536 commit 0c651a6b28f3ea055f150b863dddc6a9d67b898b
@@ -52,13 +52,11 @@ A Laravel CMS Starter project with AdminLTE theme and core features.
- https://console.developers.google.com
- Enable the 'google analytics' API
- Create api browser key for google maps
- Create service account key for google analytics
- add the email to the 'accounts' under google analytics
- download and store the p12
- go to google analytics under the admin - view settings - for the 'site id'
- more info https://github.com/spatie/laravel-analytics
- run the below to edit the config (set the name of the .p12)
- ```php artisan vendor:publish --provider="Spatie\LaravelAnalytics\LaravelAnalyticsServiceProvider"```
- Get and Setup Laravel Analytics [Laravel Analytics (Spatie)](https://github.com/spatie/laravel-analytics/tree/3.1.0)
- create service account key for google analytics (json)
- add the email to the 'accounts' under google analytics
- download and store the json
- go to google analytics under the admin - view settings - for the 'site id'
- get a Google Maps js API key (after you've created the project in google) https://developers.google.com/maps/documentation/javascript/get-api-key
- have a look at Admin\NavigationController.php on how to use datatables and datatables with ajax if more than 150 entries
@@ -2,11 +2,8 @@
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Titan\Controllers\TitanAdminController;
use Illuminate\Http\Request;
class DashboardController extends AdminController
{
@@ -2,23 +2,23 @@
namespace App\Http\Controllers\Api;
use LaravelAnalytics;
use Analytics;
use App\Http\Requests;
use Titan\Controllers\Traits\AnalyticsHelper;
use Titan\Controllers\Traits\GoogleAnalyticsHelper;
class AnalyticsController extends ApiController
{
use AnalyticsHelper;
use GoogleAnalyticsHelper;
/**
* Get the sessions grouped by country
* @return \Illuminate\Http\JsonResponse
*/
public function getVisitorsLocations()
{
$dates = $this->getStartEndDate();
$period = $this->analyticsDuration();
$data = LaravelAnalytics::performQuery($dates['start'], $dates['end'], 'ga:sessions', [
$data = Analytics::performQuery($period, 'ga:sessions', [
'dimensions' => 'ga:country',
'sort' => '-ga:sessions',
'max-results' => 50
@@ -14,10 +14,10 @@
"bpocallaghan/alert": "^1.1",
"intervention/image": "^2.4",
"bpocallaghan/notify": "^2.1",
"bpocallaghan/titan": "^0.2.6",
"bpocallaghan/titan": "^0.2.9",
"bpocallaghan/sluggable": "^1.0",
"bpocallaghan/impersonate": "^1.0",
"spatie/laravel-analytics": "1.4.1",
"spatie/laravel-analytics": "^3.1",
"yajra/laravel-datatables-oracle": "^8.0"
},
"require-dev": {
Oops, something went wrong.

0 comments on commit 0c651a6

Please sign in to comment.