mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-13 13:09:41 +02:00
Merge pull request #1311 from cisagov/nmb/513-google-analytics
#513: Add google analytics code in production
This commit is contained in:
commit
88ab9a4f08
6 changed files with 17 additions and 3 deletions
|
@ -29,6 +29,8 @@ services:
|
||||||
- IS_PRODUCTION=False
|
- IS_PRODUCTION=False
|
||||||
# Tell Django where it is being hosted
|
# Tell Django where it is being hosted
|
||||||
- DJANGO_BASE_URL=http://localhost:8080
|
- DJANGO_BASE_URL=http://localhost:8080
|
||||||
|
# Is this a production environment
|
||||||
|
- IS_PRODUCTION
|
||||||
# Public site URL link
|
# Public site URL link
|
||||||
- GETGOV_PUBLIC_SITE_URL=https://beta.get.gov
|
- GETGOV_PUBLIC_SITE_URL=https://beta.get.gov
|
||||||
# Set a username for accessing the registry
|
# Set a username for accessing the registry
|
||||||
|
|
|
@ -210,6 +210,7 @@ TEMPLATES = [
|
||||||
"registrar.context_processors.language_code",
|
"registrar.context_processors.language_code",
|
||||||
"registrar.context_processors.canonical_path",
|
"registrar.context_processors.canonical_path",
|
||||||
"registrar.context_processors.is_demo_site",
|
"registrar.context_processors.is_demo_site",
|
||||||
|
"registrar.context_processors.is_production",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,3 +31,8 @@ def is_demo_site(request):
|
||||||
should not appear.
|
should not appear.
|
||||||
"""
|
"""
|
||||||
return {"IS_DEMO_SITE": settings.IS_DEMO_SITE}
|
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}
|
||||||
|
|
|
@ -3,6 +3,14 @@
|
||||||
<html class="no-js" lang="{{ LANGUAGE_CODE }}">
|
<html class="no-js" lang="{{ LANGUAGE_CODE }}">
|
||||||
|
|
||||||
<head>
|
<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 charset="utf-8">
|
||||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
<title>
|
<title>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<h1>Manage your domains</h2>
|
<h1>Manage your domains</h2>
|
||||||
|
|
||||||
<p class="margin-top-4">
|
<p class="margin-top-4">
|
||||||
{% if is_production %}
|
{% if IS_PRODUCTION %}
|
||||||
<a href="javascript:void(0)"
|
<a href="javascript:void(0)"
|
||||||
class="usa-button usa-tooltip disabled-link"
|
class="usa-button usa-tooltip disabled-link"
|
||||||
data-position="right"
|
data-position="right"
|
||||||
|
|
|
@ -2,7 +2,6 @@ from django.db.models import F
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
from registrar.models import DomainApplication
|
from registrar.models import DomainApplication
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
|
@ -23,5 +22,4 @@ def index(request):
|
||||||
state=F("domain__state"),
|
state=F("domain__state"),
|
||||||
)
|
)
|
||||||
context["domains"] = domains
|
context["domains"] = domains
|
||||||
context["is_production"] = settings.IS_PRODUCTION
|
|
||||||
return render(request, "home.html", context)
|
return render(request, "home.html", context)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue