1 """Piwik template tag."""
3 from django import template
4 from django.conf import settings
5 from django.core.exceptions import ImproperlyConfigured
8 register = template.Library()
11 @register.inclusion_tag('piwik/tracking_code.html', takes_context=True)
12 def tracking_code(context):
14 id = settings.PIWIK_SITE_ID
15 except AttributeError:
16 raise ImproperlyConfigured('PIWIK_SITE_ID does not exist.')
18 url = settings.PIWIK_URL
19 except AttributeError:
20 raise ImproperlyConfigured('PIWIK_URL does not exist.')
21 return {'id': id, 'url': url, 'AB': context.get('AB')}