Use {% urchin "UA-1234567-1" %}
to insert the Javascript snippet for a Google Analytics site.
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
- Generate and render HTML Table by LLyaudet 6 days, 9 hours ago
- My firs Snippets by GutemaG 1 week, 2 days ago
- FileField having auto upload_to path by junaidmgithub 1 month, 2 weeks ago
- LazyPrimaryKeyRelatedField by LLyaudet 1 month, 3 weeks ago
- CacheInDictManager by LLyaudet 1 month, 3 weeks 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
#
Please login first before commenting.