If ANALYTICS_KEY in the environment, enable gAnalytics

This commit is contained in:
James Polley 2018-06-30 09:37:30 +10:00
parent b39b748eee
commit 20c6da375e
5 changed files with 27 additions and 9 deletions

View file

@ -105,6 +105,10 @@ function (slug, sha) {
"name": "SYMPOSION_DEV_MODE",
"value": "LAPTOP"
},
{
"name": "ANALYTICS_KEY",
"value": "UA-000000000-1"
}
],
"image": "asia.gcr.io/linuxconfsydney/symposion_app_2019_dev:" + sha,
"imagePullPolicy": "Always",

View file

@ -47,6 +47,8 @@ PINAX_STRIPE_PUBLIC_KEY = os.environ.get('STRIPE_PUBLIC_KEY', None)
PINAX_STRIPE_SECRET_KEY = os.environ.get('STRIPE_SECRET_KEY', None)
PINAX_STRIPE_SEND_EMAIL_RECEIPTS = False
ANALYTICS_KEY = os.environ.get('ANALYTICS_KEY', None)
saml2_entityid = os.environ.get('SAML2_ENTITYID', None)
saml2_sp_name = os.environ.get('SAML2_SP_NAME', None)
saml2_sp_assertion_service = os.environ.get('SAML2_SP_ASSERTION_SERVICE', None)
@ -150,6 +152,7 @@ TEMPLATES = [
"django.contrib.messages.context_processors.messages",
"pinax_theme_bootstrap.context_processors.theme",
"symposion.reviews.context_processors.reviews",
"django_settings_export.settings_export",
],
},
},
@ -415,6 +418,11 @@ GAPC_STORAGE = {
'num_retries': 2,
}
SETTINGS_EXPORT = [
'DEBUG',
'ANALYTICS_KEY',
]
if DEV_MODE and DEV_MODE == "LAPTOP":
print("ENABLING LAPTOP MODE")
from .devmode_settings import *

View file

@ -11,13 +11,6 @@
<html lang="en">
<head>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-63600300-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-63600300-1');
</script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
@ -88,6 +81,19 @@
<script src="{% static 'js/jquery.formset.js' %}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="{% static 'bootstrap/js/bootstrap.bundle.min.js' %}"></script>
{% if settings.ANALYTICS_KEY %}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ settings.ANALYTICS_KEY }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ settings.ANALYTICS_KEY }}');
</script>
{% else %}
<!--no-analytics-->
{% endif %}
{% block extra_script %}
{% endblock %}
{% block scripts_extra %}{% endblock %}

View file

@ -141,4 +141,3 @@ def ticket_type(context):
# Default to product type
return ticket_type

View file

@ -7,6 +7,7 @@ dj-database-url==0.4.2
pylibmc==1.5.1
django-debug-toolbar>=1.7
django-bootstrap-form
django-settings-export~=1.2.1
djangosaml2
django-gapc-storage>=0.4.1
@ -50,4 +51,4 @@ libsass==0.14.5
django-sass-processor==0.7
django-compressor==2.2
django-crispy-forms
django-crispy-forms