diff --git a/system/functions.php b/system/functions.php index a8194633..0d801026 100644 --- a/system/functions.php +++ b/system/functions.php @@ -529,8 +529,8 @@ function template_footer(): string function template_ga_code() { - global $config, $twig; - if(!isset($config['google_analytics_id'][0])) + global $twig; + if(!isset(setting('core.google_analytics_id')[0])) return ''; return $twig->render('google_analytics.html.twig'); diff --git a/system/settings.php b/system/settings.php index 94370237..6208fd76 100644 --- a/system/settings.php +++ b/system/settings.php @@ -95,7 +95,7 @@ return [ 'google_analytics_id' => [ 'name' => 'Google Analytics ID', 'type' => 'text', - 'desc' => 'UA-XXXXXXX-X', + 'desc' => 'Format: UA-XXXXXXX-X', 'default' => '', ], [ diff --git a/system/templates/google_analytics.html.twig b/system/templates/google_analytics.html.twig index 2b424ddd..a1b15cf5 100644 --- a/system/templates/google_analytics.html.twig +++ b/system/templates/google_analytics.html.twig @@ -4,6 +4,6 @@ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); - ga('create', '{{ config.google_analytics_id }}', 'auto'); + ga('create', '{{ setting('core.google_analytics_id') }}', 'auto'); ga('send', 'pageview'); - \ No newline at end of file +