Many third-party website tracking tools and widgets (e.g. Google Analytics, Piwik) require you to copy and paste the Javascript code into the bottom of your site right before the closing tag.
If your site is based on Django, what is the standard way to add this type of code to the site?
You:
- paste it directly into base.html
- create {% block extra_js%} {% endblock%} right before the closing body tag in the base.html file and paste it there and / or another template
- create a new Django application (assuming there isn’t one, not one that suits your needs)
- or do something else?
And if you are a consultant with inexperienced clients, and you are doing option 3, do you advise your clients to follow the same approach when they add the project code themselves?
source share