Add Google Analytics tracking ID to settings and to main template #382 (#551)

This commit is contained in:
Nabeel S
2020-02-12 18:28:11 -05:00
committed by GitHub
parent b9993b9c23
commit 77f2138a1c
4 changed files with 94 additions and 51 deletions
+7
View File
@@ -40,6 +40,13 @@
options: '' options: ''
type: boolean type: boolean
description: 'Send some data (php version, mysql version) to phpVMS. See AnalyticsSvc code for details' description: 'Send some data (php version, mysql version) to phpVMS. See AnalyticsSvc code for details'
- key: general.google_analytics_id
name: 'Google Analytics Tracking ID'
group: general
value: ''
options: ''
type: text
description: 'Enter your Google Analytics Tracking ID'
- key: units.distance - key: units.distance
name: 'Distance Units' name: 'Distance Units'
group: units group: units
+4 -4
View File
@@ -70,13 +70,13 @@
<li><a href="{!! url('/admin/roles') !!}"><i class="pe-7s-network"></i>roles</a></li> <li><a href="{!! url('/admin/roles') !!}"><i class="pe-7s-network"></i>roles</a></li>
@endability @endability
@ability('admin', 'settings')
<li><a href="{{ url('/admin/settings') }}"><i class="pe-7s-config"></i>settings</a></li>
@endability
@ability('admin', 'maintenance') @ability('admin', 'maintenance')
<li><a href="{{ url('/admin/maintenance') }}"><i class="pe-7s-tools"></i>maintenance</a></li> <li><a href="{{ url('/admin/maintenance') }}"><i class="pe-7s-tools"></i>maintenance</a></li>
@endability @endability
@ability('admin', 'settings')
<li><a href="{{ url('/admin/settings') }}"><i class="pe-7s-config"></i>settings</a></li>
@endability
</ul> </ul>
</div> </div>
</li> </li>
+15 -1
View File
@@ -2,6 +2,7 @@
@foreach($grouped_settings as $group => $settings) @foreach($grouped_settings as $group => $settings)
<div class="card border-blue-bottom"> <div class="card border-blue-bottom">
<div class="content table-responsive table-full-width"> <div class="content table-responsive table-full-width">
<div class="row">
<table class="table table-hover" id="flights-table"> <table class="table table-hover" id="flights-table">
<thead> <thead>
<th colspan="2"> <th colspan="2">
@@ -52,16 +53,29 @@
@endforeach @endforeach
</table> </table>
</div> </div>
{{--<div class="row">
<div class="col-sm-12 text-right">
{{ Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) }}
<a href="{{ route('admin.subfleets.index') }}" class="btn btn-default">Cancel</a>
</div>
</div>--}}
</div>
</div> </div>
@endforeach @endforeach
<div class="card"> <div class="card">
<div class="content"> <div class="content">
<div class="text-right"> <div class="row">
<div class="col-sm-12 text-right">
{{ Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) }} {{ Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) }}
<a href="{{ route('admin.subfleets.index') }}" class="btn btn-default">Cancel</a> <a href="{{ route('admin.subfleets.index') }}" class="btn btn-default">Cancel</a>
</div> </div>
</div> </div>
</div> </div>
</div>
{{ Form::close() }} {{ Form::close() }}
<script> <script>
$(document).ready(function () { $(document).ready(function () {
@@ -108,5 +108,27 @@ with the EU Cookie Law https://privacypolicies.com/blog/eu-cookie-law
$(".select2").select2({width: 'resolve'}); $(".select2").select2({width: 'resolve'});
}); });
</script> </script>
{{--
Google Analytics tracking code. Only active if an ID has been entered
You can modify to any tracking code and re-use that settings field, or
just remove it completely. Only added as a convenience factor
--}}
@php
$gtag = setting('general.google_analytics_id');
@endphp
@if($gtag)
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ $gtag }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ $gtag }}');
</script>
@endif
{{-- End of the Google Analytics code --}}
</body> </body>
</html> </html>