1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | from django import template
register = template.Library()
def urchin(uacct):
return """
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "%(uacct)s";
urchinTracker();
</script>
""" % { 'uacct': uacct }
register.simple_tag(urchin)
|
More like this
- Google Analytics Template Tag by jarofgreen 3 years, 9 months ago
- Google Analytics noscript tracking by ganzogo 2 years, 3 months ago
- Google Analytics Templatetag by rizumu 4 years, 7 months ago
- Silently-failing include tag by brutasse 2 years, 11 months ago
- Strip Google Analytics cookies for caching middleware purposes by nf 3 years, 6 months ago
Comments
good thing will be to tie this to settings.py and/or sites framework.
#
it's worth noting the google javascript has changed since this was posted
#
I've extended this with extra features - see http://www.djangosnippets.org/snippets/1656/
#