Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/django_project/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,5 @@
)
PROJECT_VERSION = env.str("IMAGE_TAG", "0.0.0")
PROJECT_SOURCE = "https://github.com/SpokaneTech/SpokanePythonWeb"

GOOGLE_ANALYTICS_TAG_ID: str | None = env.str("GOOGLE_ANALYTICS_TAG_ID", None)
12 changes: 7 additions & 5 deletions src/django_project/web/templates/web/full/host_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
<html lang="en">

<head>
{% if GOOGLE_ANALYTICS_TAG_ID %}
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-X6VK8H1VLF"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ GOOGLE_ANALYTICS_TAG_ID }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-X6VK8H1VLF');
gtag('config', '{{ GOOGLE_ANALYTICS_TAG_ID }}');
</script>
{% endif %}
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
Expand Down
12 changes: 7 additions & 5 deletions src/django_project/web/templates/web/full/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
<html lang="en">

<head>
{% if GOOGLE_ANALYTICS_TAG_ID %}
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-X6VK8H1VLF"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ GOOGLE_ANALYTICS_TAG_ID }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-X6VK8H1VLF');
gtag('config', '{{ GOOGLE_ANALYTICS_TAG_ID }}');
</script>
{% endif %}
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
Expand Down
1 change: 1 addition & 0 deletions src/envs/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ SECRET_KEY=change_me
ALLOWED_HOSTS=localhost,127.0.0.1
INTERNAL_IPS=localhost,127.0.0.1
DJANGO_SETTINGS_MODULE=core.settings
GOOGLE_ANALYTICS_TAG_ID=
LOG_PATH="/home/$USER/projects/django_project/django_logs"
DB_ENGINE=django.db.backends.sqlite3
DB_NAME=my_django_project.sqlite3
Expand Down