
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
django-google-analytics-app
Advanced tools
Django Google Analytics app allowing for server side/non-js tracking.
Django Google Analytics brings the power of server side/non-js Google Analytics to your Django projects
.. contents:: Contents :depth: 3
#. Install django-google-analytics-app
from PyPI or add to your Python path some other way.
#. Add google_analytics
to your INSTALLED_APPS
setting.
#. Add URL include to your project's urls.py
file::
re_path('djga/', include('google_analytics.urls')),
#. Specify a Google Analytics tracking code <https://support.google.com/analytics/bin/answer.py?hl=en&answer=1008080>
_, i.e.::
GOOGLE_ANALYTICS = {
'google_analytics_id': 'UA-000000-2',
}
where UA-000000-2
is your unique tracking code.
#. If you intend tracking through middleware and Celery remember to install Celery and run its worker process <http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html>
_.
There are two ways to add tracking to your pages.
Using <img/>
and sticking it in your base.html
::
{% load google_analytics_tags %}
<div style="display:none">
<img src="{% google_analytics %}" width="0" height="0" />
</div>
2. Middleware + Celery
Using Django's middleware, you can process every request and use Celery to make the request to Google Analytics::
MIDDLEWARE = [
'google_analytics.middleware.GoogleAnalyticsMiddleware',
]
You have to add google_analytics
to your CELERY_IMPORTS
::
CELERY_IMPORTS = ('google_analytics.tasks')
You can also specify paths that will be excluded when tracking::
GOOGLE_ANALYTICS_IGNORE_PATH = ['/health/', ]
FAQs
Django Google Analytics app allowing for server side/non-js tracking.
We found that django-google-analytics-app demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.