Skip to content

Commit

Permalink
Upgrade Spatie Laravel Analytics package to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
bpocallaghan committed Oct 26, 2017
1 parent 614b536 commit 0c651a6
Show file tree
Hide file tree
Showing 10 changed files with 458 additions and 184 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 1 addition & 4 deletions app/Http/Controllers/Admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
10 changes: 5 additions & 5 deletions app/Http/Controllers/Api/AnalyticsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading

0 comments on commit 0c651a6

Please sign in to comment.