diff --git a/README.md b/README.md index 45bb7a0..11aff6d 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ heroku config:set 'SECRET_KEY=VALOR-RANDOMICO-QUE-O-STARTPROJECT-GERA-PRA-VC' heroku config:set DEBUG=False heroku config:set 'RECAPTCHA_PUBLIC_KEY=CHAVE-PUBLICA-DO-RECAPTCHA' heroku config:set 'RECAPTCHA_PRIVATE_KEY=CHAVE-PRIVADA-DO-RECAPTCHA' +heroku config:set 'GTM_CONTAINER=CONTAINER-DO-GOOGLE-TAG-MANAGER' git push heroku master heroku run python manage.py syncdb --migrate ``` @@ -43,3 +44,6 @@ heroku run python manage.py syncdb --migrate #Gerar credenciais do reCaptcha Para gerar as credenciais do reCaptcha acesse http://www.google.com/recaptcha + +#Configurar o Google Tag Manager +Através do Google Tag Manager é possível configurar o Google Analytics e outras ferramentas externas. Para configurar uma conta acesse: https://www.google.com/tagmanager diff --git a/telemob/main/context_processors.py b/telemob/main/context_processors.py new file mode 100644 index 0000000..9ac8630 --- /dev/null +++ b/telemob/main/context_processors.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- + +from django.conf import settings + + +def google_tag_manager(request): + return {'GTM_CONTAINER': settings.GTM_CONTAINER} diff --git a/telemob/settings.py b/telemob/settings.py index 8e45f6f..4a05fe2 100644 --- a/telemob/settings.py +++ b/telemob/settings.py @@ -99,6 +99,7 @@ 'django.core.context_processors.tz', 'django.contrib.messages.context_processors.messages', 'django.core.context_processors.request', + 'telemob.main.context_processors.google_tag_manager' ) TEMPLATE_DIRS = ( @@ -115,6 +116,12 @@ default='1234567897132123' ) +# Google Tag Manager +GTM_CONTAINER = config( + 'GTM_CONTAINER', + default=None +) + RECAPTCHA_PRIVATE_KEY = config( 'RECAPTCHA_PRIVATE_KEY', default='1234567897132123' diff --git a/telemob/templates/base.html b/telemob/templates/base.html index c3384f1..07bb1b3 100644 --- a/telemob/templates/base.html +++ b/telemob/templates/base.html @@ -50,6 +50,19 @@ + + {% if GTM_CONTAINER %} + + + + + {% endif %} + {% block js %}{% endblock js %}