Include Google Analytics on production

This commit is contained in:
Neil Martinsen-Burrell 2023-11-07 09:48:43 -06:00
parent 3eef418ff8
commit bfe97c38ba
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184
2 changed files with 13 additions and 0 deletions

View file

@ -31,3 +31,8 @@ def is_demo_site(request):
should not appear.
"""
return {"IS_DEMO_SITE": settings.IS_DEMO_SITE}
def is_production(request):
"""Add a boolean if this is our production site."""
return {"IS_PRODUCTION": settings.IS_PRODUCTION}

View file

@ -3,6 +3,14 @@
<html class="no-js" lang="{{ LANGUAGE_CODE }}">
<head>
{% if IS_PRODUCTION %}
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-PZ5QSP6QPL"></script>
<script>
window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-PZ5QSP6QPL');
</script>
{% endif %}
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>