Skip to content

Commit

Permalink
Change namespace to be consistant with github and abstract settings i…
Browse files Browse the repository at this point in the history
…nto Statamic Settings
  • Loading branch information
jcohlmeyer authored and JRC9 Devs committed Mar 17, 2018
1 parent 925cc72 commit 8243d5e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
13 changes: 10 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
{
"name": "jrc9ds/statamic-laravel-analytics",
"name": "jrc9designstudio/statamic-laravel-analytics",
"description": "A Laravel 5 package to retrieve Google Analytics data.",
"keywords": [
"spatie",
"google",
"analytics",
"retrieve",
"reports",
"laravel"
"laravel",
"statamic"
],
"homepage": "https://github.com/jrc9ds/statamic-laravel-analytics",
"homepage": "https://github.com/jrc9designstudio/statamic-laravel-analytics",
"license": "MIT",
"authors": [
{
"name": "Jonathan Cohlmeyer",
"email": "[email protected]",
"homepage": "https://jrc9.ca",
"role": "Developer"
},
{
"name": "Freek Van der Herten",
"email": "[email protected]",
Expand Down
26 changes: 4 additions & 22 deletions src/AnalyticsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

class AnalyticsServiceProvider extends ServiceProvider
{
private $google_analytics;

/**
* Bootstrap the application events.
*/
Expand All @@ -22,29 +24,9 @@ public function boot()
*/
public function register()
{
$analyticsConfig = [
/*
* The view id of which you want to display data.
*/
'view_id' => env('GOOGLE_ANALYTICS_VIEW_ID'),

/*
* Path to the json file with service account credentials. Take a look at the README of this package
* to learn how to get this file.
*/
'service_account_credentials_json' => storage_path('../../site/settings/addons/google-analytics-credentials.json'),

/*
* The amount of minutes the Google API responses will be cached.
* If you set this to zero, the responses won't be cached at all.
*/
'cache_lifetime_in_minutes' => 60 * 24,
$this->google_analytics = new \Statamic\Addons\GoogleAnalytics\GoogleAnalyticsAPI;

/*
* The directory where the underlying Google_Client will store it's cache files.
*/
'cache_location' => storage_path('../local/cache/laravel-google-analytics/google-cache/'),
];
$analyticsConfig = $this->google_analytics->analyticsConfig();

$this->app->bind(AnalyticsClient::class, function () use ($analyticsConfig) {
return AnalyticsClientFactory::createForConfig($analyticsConfig);
Expand Down

0 comments on commit 8243d5e

Please sign in to comment.