Fixed obtaining ga code from dict

This commit is contained in:
M.Ravi 2017-08-24 16:10:53 +02:00
parent 01b64fec88
commit bf304f9493

View file

@ -13,7 +13,8 @@ def google_analytics(request):
# Try checking if we have a www in host, if yes we remove # Try checking if we have a www in host, if yes we remove
# that and check in the dict again # that and check in the dict again
if host.startswith('www.'): if host.startswith('www.'):
ga_prop_id = host[4:] ga_prop_id = getattr(settings, 'GOOGLE_ANALYTICS_PROPERTY_IDS',
False).get(host[4:])
if not settings.DEBUG and ga_prop_id: if not settings.DEBUG and ga_prop_id:
return { return {
'GOOGLE_ANALYTICS_PROPERTY_ID': ga_prop_id 'GOOGLE_ANALYTICS_PROPERTY_ID': ga_prop_id