![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Simple Google Analytics integration for Django.
Honestly, all the other Google Analytics Django apps suck. All I want to do is
put my Google Analytics code in my settings.py
file, and use a simple
template tag to render the Google Analytics asynchronous javascript code,
damnet!
Unfortunately, all the existing solutions don't do this, and that pisses me off!
Anyway, let's install this bitch! The first thing you'll want to do is run:
$ pip install django-ganalytics
Next, modify your settings.py
file, and add your Google Analytics code
(usually something like UA-XXXXXXXX-XX
), as well as put
ganalytics
in your INSTALLED_APPS
:
# settings.py
INSTALLED_APPS = (
# ...
'ganalytics',
)
GANALYTICS_TRACKING_CODE = 'UA-XXXXXXXX-XX'
Now, to actually render your Google Analytics asynchronous javascript code,
edit your desired Django template (I like to do this in my base.html
template), and add the following:
{% load ganalytics %}
<!--- ... -->
<head>
{% ganalytics %}
</head>
<!--- ... -->
When Django processes your template, it'll replace {% ganalytics %}
with:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{{ GANALYTICS_TRACKING_CODE }}', 'auto');
ga('send', 'pageview');
</script>
Easy, right?
FAQs
Simple Google Analytics integration for Django.
We found that django-ganalytics demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.