From 21ef4de5c98ae6d214aff325edb4e098a660fa55 Mon Sep 17 00:00:00 2001 From: Andy Heathershaw Date: Fri, 28 Oct 2016 16:07:24 +0100 Subject: [PATCH] BLUE-11: Added another config field to allow an admin to set Google Analytics or other RUM tracking code --- app/Helpers/ConfigHelper.php | 1 + app/Http/Controllers/Admin/DefaultController.php | 3 ++- resources/lang/en/admin.php | 5 ++++- resources/views/themes/base/admin/settings.blade.php | 9 +++++++++ resources/views/themes/base/layout.blade.php | 1 + 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/Helpers/ConfigHelper.php b/app/Helpers/ConfigHelper.php index 610728a..dffdc08 100644 --- a/app/Helpers/ConfigHelper.php +++ b/app/Helpers/ConfigHelper.php @@ -83,6 +83,7 @@ class ConfigHelper return array( 'allow_self_registration' => true, + 'analytics_code' => '', 'app_name' => trans('global.app_name'), 'date_format' => $this->allowedDateFormats()[0], 'default_album_view' => $this->allowedAlbumViews()[0], diff --git a/app/Http/Controllers/Admin/DefaultController.php b/app/Http/Controllers/Admin/DefaultController.php index ae0cd02..f46acc2 100644 --- a/app/Http/Controllers/Admin/DefaultController.php +++ b/app/Http/Controllers/Admin/DefaultController.php @@ -74,7 +74,8 @@ class DefaultController extends Controller 'smtp_password', 'theme', 'recaptcha_site_key', - 'recaptcha_secret_key' + 'recaptcha_secret_key', + 'analytics_code' ]; $defaults = UserConfig::defaults(); diff --git a/resources/lang/en/admin.php b/resources/lang/en/admin.php index a367630..330d5c0 100644 --- a/resources/lang/en/admin.php +++ b/resources/lang/en/admin.php @@ -128,5 +128,8 @@ return [ 'user_deletion_failed' => 'An error occurred while removing :name\'s user account: :error_message', 'user_deletion_successful' => 'The user account for :name was removed successfully.', 'user_pending' => 'Pending activation', - 'users_title' => 'User accounts' + 'users_title' => 'User accounts', + 'visitor_analytics_heading' => 'Visitor analytics', + 'visitor_analytics_p' => 'If you would like to analyse your visitor\'s activity using Google Analytics, Piwik or other real-time user monitoring services, please copy and paste the tracking code in the box below.', + 'visitor_analytics_p2' => 'This code will appear at the end of your site\'s body tag. Remember to include the "script" tags.' ]; \ No newline at end of file diff --git a/resources/views/themes/base/admin/settings.blade.php b/resources/views/themes/base/admin/settings.blade.php index 0f99686..8dc72df 100644 --- a/resources/views/themes/base/admin/settings.blade.php +++ b/resources/views/themes/base/admin/settings.blade.php @@ -70,6 +70,15 @@ + +
+
+ @lang('admin.visitor_analytics_heading') +

@lang('admin.visitor_analytics_p')

+

@lang('admin.visitor_analytics_p2')

+ + {!! Form::textarea('analytics_code', old('analytics_code'), ['class' => 'form-control', 'rows' => 10]) !!} +
{{-- E-mail --}} diff --git a/resources/views/themes/base/layout.blade.php b/resources/views/themes/base/layout.blade.php index 3f27f4a..e86396e 100644 --- a/resources/views/themes/base/layout.blade.php +++ b/resources/views/themes/base/layout.blade.php @@ -93,5 +93,6 @@ }); @stack('scripts') + {!! \App\Facade\UserConfig::get('analytics_code') !!}