[CI] (cef44b4) django/django3-saas#1383
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
Conversation
Author
PR Evaluation ReportSummaryThis PR integrates PostHog analytics into a Django 3 SaaS application. It initializes PostHog in
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | All syntax is valid, imports resolve, no missing dependencies |
| Preserves existing env vars & configs | Yes | Existing settings, env vars, and app configs are preserved; only PostHog additions made |
| No syntax or type errors | Yes | All Python code is syntactically correct |
| Correct imports/exports | Yes | import posthog is correct for module-level API; middleware import path is valid |
| Minimal, focused changes | Yes | All changes directly relate to PostHog integration |
| Pre-existing issues | None | No pre-existing issues observed |
Issues
.env.examplenot updated with PostHog variables:POSTHOG_PROJECT_TOKENandPOSTHOG_HOSTare referenced insettings.pybut not documented in.env.example. Add them so new developers know to configure these values. [MEDIUM]
Other completed criteria
- Build configuration is valid —
requirements.txtproperly includesposthog accountsentry inINSTALLED_APPScorrectly updated toaccounts.apps.AccountsConfig- PosthogContextMiddleware properly positioned in middleware stack
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog added to requirements.txt |
| PostHog client initialized | Yes | Initialized in AccountsConfig.ready() with api_key and host from Django settings; atexit.register(posthog.shutdown) ensures flush on exit |
| capture() | Yes | 12 meaningful capture calls across accounts, billing, and dashboard views |
| identify() | N/A | Server-only app |
| Error tracking | Yes | PosthogContextMiddleware captures exceptions by default (Django-recommended approach) |
| Reverse proxy | N/A | Server-only app |
Issues
- Module-level init instead of
Posthog()constructor: The code usesposthog.api_key = settings.POSTHOG_PROJECT_TOKENinstead of the recommendedposthog = Posthog(api_key, host=host, enable_exception_autocapture=True)instance-based pattern. This meansenable_exception_autocapture=Truecannot be set, relying solely on the middleware for exception capture. The middleware handles request-scoped exceptions, but exceptions outside request contexts won't be auto-captured. [MEDIUM]
Other completed criteria
- API key loaded from environment variable via
os.environ.get('POSTHOG_PROJECT_TOKEN', '') - Host correctly configured with default
https://us.i.posthog.com atexit.register(posthog.shutdown)ensures events are flushed on exit- Context API (
new_context(),identify_context(),capture()) used correctly throughout identify_context(str(user.id))uses real user IDs from Django auth — correct distinct_id pattern
PostHog insights and events ⚠️
| Filename | PostHog events | Description |
|---|---|---|
accounts/views.py |
user_logged_in, user_logged_out, user_registered, profile_updated |
Auth lifecycle events; login includes login_method, registration includes has_company |
billing/views.py |
checkout_initiated, subscription_started, plan_changed, subscription_canceled, payment_failed |
Full subscription lifecycle with plan_slug/interval properties; plan_changed tracks old→new plan |
dashboard/views.py |
project_created, project_updated, project_deleted |
Project CRUD events with is_active property on create/update |
Issues
- Username set as event property via
tag(): Inaccounts/views.py,posthog.tag('username', user.username)adds the username to all events captured in that context. Usernames are user-identifying information and should be set as person properties using `` within a capture call, not as event-level tags. Replace withposthog.capture('user_logged_in', properties={'login_method': 'email', '': {'username': user.username}}). [MEDIUM]
Other completed criteria
- All events represent real user actions mapped to actual product flows
- Events enable product insights: signup→project funnel, subscription conversion trends, churn monitoring
- Events include relevant contextual properties (plan_slug, plan_interval, has_company, is_active, old/new plan)
- Event names are descriptive, consistent snake_case convention
- No emails, phone numbers, or other explicit PII in event properties (only username concern noted above)
Reviewed by wizard workbench PR evaluator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated wizard CI run
Source: context-mill-pr
Trigger ID:
cef44b4App:
django/django3-saasApp directory:
apps/django/django3-saasWorkbench branch:
wizard-ci-cef44b4-django-django3-saasWizard branch:
mainContext Mill branch:
basic-skills-v2PostHog (MCP) branch:
masterTimestamp: 2026-05-01T20:41:22.976Z
Duration: 337.5s