mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 08:12:15 +00:00
improved tracking for google analytics
This commit is contained in:
9
resources/js/main.js
vendored
9
resources/js/main.js
vendored
@@ -3,6 +3,7 @@ import Vue from 'vue'
|
||||
import i18n from './i18n'
|
||||
import VueRouter from 'vue-router'
|
||||
import router from './router'
|
||||
import VueAnalytics from 'vue-analytics'
|
||||
import App from './App.vue'
|
||||
import store from './store'
|
||||
import { events } from './bus'
|
||||
@@ -21,6 +22,14 @@ Vue.use(functionHelpers)
|
||||
Vue.use(AlertHelpers)
|
||||
Vue.use(itemHelpers)
|
||||
|
||||
// Google Analytics implementation
|
||||
if (config.googleAnalytics) {
|
||||
Vue.use(VueAnalytics, {
|
||||
id: config.googleAnalytics,
|
||||
router
|
||||
})
|
||||
}
|
||||
|
||||
// ReCaptcha configuration
|
||||
if (config.allowedRecaptcha) {
|
||||
Vue.use(VueReCaptcha, {
|
||||
|
||||
@@ -149,6 +149,9 @@
|
||||
// App settings
|
||||
userRegistration: {{ $config->registration->allowed }},
|
||||
userVerification: {{ $config->registration->verification }},
|
||||
|
||||
// Google Analytics
|
||||
googleAnalytics: '{{ $config->google_analytics }}',
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -156,18 +159,6 @@
|
||||
|
||||
{{--Application production script--}}
|
||||
<script src="{{ asset('js/main.js') }}?v={{ get_version() }}"></script>
|
||||
|
||||
{{--Global site tag (gtag.js) - Google Analytics--}}
|
||||
@if($config->google_analytics)
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ $config->google_analytics }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '{{ $config->google_analytics }}');
|
||||
</script>
|
||||
@endif
|
||||
@else
|
||||
{{--Application development script--}}
|
||||
<script src="{{ mix('js/main.js') }}"></script>
|
||||
|
||||
Reference in New Issue
Block a user