Private
Public Access
1
0

added Google Analytics

This commit is contained in:
Sander Roosendaal
2017-03-28 07:53:46 +02:00
parent d8c5454ac4
commit a13bed1205
5 changed files with 44 additions and 3 deletions

20
context_processors.py Normal file
View File

@@ -0,0 +1,20 @@
from django.conf import settings
def google_analytics(request):
"""
Use the variables returned in this function to
render your Google Analytics tracking code template.
"""
ga_prop_id = getattr(settings, 'GOOGLE_ANALYTICS_PROPERTY_ID', False)
ga_domain = getattr(settings, 'GOOGLE_ANALYTICS_DOMAIN', False)
if not settings.DEBUG and ga_prop_id and ga_domain:
return {
'GOOGLE_ANALYTICS_PROPERTY_ID': ga_prop_id,
'GOOGLE_ANALYTICS_DOMAIN': ga_domain,
}
return {}
def hello_world(request):
return {
'helloworld': 'hi Sander'
}