diff --git a/.env.example b/.env.example index 378e6ee..cf029e0 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/app/config/view.php b/app/config/view.php index 68e2531..110d5f8 100644 --- a/app/config/view.php +++ b/app/config/view.php @@ -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. diff --git a/app/resources/views/components/google-analytics.twig b/app/resources/views/components/google-analytics.twig new file mode 100644 index 0000000..37cc488 --- /dev/null +++ b/app/resources/views/components/google-analytics.twig @@ -0,0 +1,11 @@ + + + diff --git a/app/resources/views/layouts/app.twig b/app/resources/views/layouts/app.twig index 4b8fc80..a2cf19e 100644 --- a/app/resources/views/layouts/app.twig +++ b/app/resources/views/layouts/app.twig @@ -6,6 +6,10 @@ +{% if config('google_analytics_id', false) %} + {% include 'components/google-analytics.twig' %} +{% endif %} + {{ path == '.' ? 'Home' : path }} • Directory Lister