Roman Imankulov

Roman Imankulov

Full-stack Python web developer from Porto

search results (esc to close)
27 Apr 2022

Django Plausible Proxy

Django Plausible Proxy

I released Django Plausible Proxy, a Django application to proxy requests and send server-side events to Plausible Analytics.

Plausible is a lightweight and open-source web analytics platform, a privacy-friendly alternative to Google Analytics. I started using it for Django side projects about a month ago and loved its minimalistic interface and “exactly what I need” type of reports.

Initially, the integration code lived inside the project, but as it grew in functionality, I extracted it in a separate package that is available on PyPI and GitHub.

Proxying

Proxying allows a project owner concerned about missing data to see a complete picture. See Adblockers and using a proxy for analytics for the detailed outline of the problem and solution.

When installed and configured in settings.py and urls.py, the app proxies the HTTP requests as such:

https://<yourdomain.com>/js/script.js -> https://plausible.io/js/script.js
https://<yourdomain.com>/api/event    -> https://plausible.io/api/event

Server-side events

Sending events from Python code lets you keep track of events that can’t be recorded otherwise, such as API requests. In the code, it looks like this:

from plausible_proxy import send_custom_event
...
send_custom_event(request, name="Register", props={"plan": "Premium"})
Roman Imankulov

Hey, I'm Roman, a full-stack Python web developer.

If you like what you read and want to work with me, drop me a line to roman.imankulov@gmail.com.

About me