mirror of
https://github.com/DirectoryLister/DirectoryLister.git
synced 2025-08-30 09:10:38 +02:00
Enabled Google Analytics tracking via configuration
This commit is contained in:
@@ -8,6 +8,8 @@ HIDE_VCS_FILES=true
|
||||
|
||||
DISPLAY_READMES=true
|
||||
|
||||
GOOGLE_ANALYTICS_ID=false
|
||||
|
||||
DATE_FORMAT="Y-m-d H:i:s"
|
||||
|
||||
MAX_HASH_SIZE=1000000000
|
||||
|
@@ -10,6 +10,14 @@ return [
|
||||
*/
|
||||
'dark_mode' => Helpers::env('DARK_MODE'),
|
||||
|
||||
/**
|
||||
* Your Google analytics tracking ID.
|
||||
* Expected format: 'UA-123456789-0'.
|
||||
*
|
||||
* Default value: false
|
||||
*/
|
||||
'google_analytics_id' => Helpers::env('GOOGLE_ANALYTICS_ID'),
|
||||
|
||||
/**
|
||||
* Default date format. For additional info on date formatting see:
|
||||
* https://www.php.net/manual/en/function.date.php.
|
||||
|
11
app/resources/views/components/google-analytics.twig
Normal file
11
app/resources/views/components/google-analytics.twig
Normal file
@@ -0,0 +1,11 @@
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ config("google_analytics_id") }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
{% if config('google_analytics_id', false) %}
|
||||
gtag('config', '{{ config("google_analytics_id") }}');
|
||||
{% endif %}
|
||||
</script>
|
@@ -6,6 +6,10 @@
|
||||
<link rel="icon" href="{{ config('dark_mode') ? asset('images/favicon.dark.png') : asset('images/favicon.light.png') }}">
|
||||
<link rel="stylesheet" href="{{ asset('app.css') }}">
|
||||
|
||||
{% if config('google_analytics_id', false) %}
|
||||
{% include 'components/google-analytics.twig' %}
|
||||
{% endif %}
|
||||
|
||||
<title>{{ path == '.' ? 'Home' : path }} • Directory Lister</title>
|
||||
|
||||
<div id="app" class="flex flex-col min-h-screen font-sans {{ config('dark_mode') ? 'dark-mode' : 'light-mode' }}">
|
||||
|
Reference in New Issue
Block a user