Skip to content

PP-605: Add extra Mixpanel settings and context#4

Merged
johngathure merged 2 commits intowp-media:trunkfrom
gautam-groupone:PP-605
Jan 22, 2026
Merged

PP-605: Add extra Mixpanel settings and context#4
johngathure merged 2 commits intowp-media:trunkfrom
gautam-groupone:PP-605

Conversation

@gautam-groupone
Copy link
Copy Markdown
Contributor

@gautam-groupone gautam-groupone commented Jan 21, 2026

Description

Fixes 605

This PR enhances the library with improved tracking capabilities, path exclusion functionality, and new event tracking methods. It adds support for filtering events by host, excluding API/health check endpoints, and provides methods for tracking specific events (Order Placed, SSO Link Clicked, Actionable Resolved).

Type of change

  • New feature (non-breaking change which adds functionality).
  • Bug fix (non-breaking change which fixes an issue).
  • Enhancement (non-breaking change which improves an existing functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as before).
  • Sub-task of #(issue number)
  • Chore
  • Release

Detailed scenario

What was tested

Automated tests:

  • All existing tests pass
  • New tests for path exclusion
  • New tests for three event tracking methods
  • Updated tests for host property in middleware and views.

How to test

Testing via existing pytests, mypy and ruff

Affected Features & Quality Assurance Scope

Affected features:

  1. Django middleware automatic page view tracking (now includes host, supports path exclusion)
  2. Django views mixin (now includes host in payload)
  3. Core tracking class (new event tracking methods)

QA Scope:

  1. Verify middleware correctly excludes paths matching EXCLUDE_PATHS patterns
  2. Verify host is included in all middleware and view tracking events
  3. Verify new tracking methods send correct event names and properties

Technical description

Documentation

Changes made:

  1. Host in payload (django_middleware.py, django_views.py):

    • Added host property to all tracked events via request.get_host()
  2. Path exclusion (django_middleware.py):

    • New EXCLUDE_PATHS setting accepts list of regex patterns.
    • _should_exclude_path() method checks if request path matches any exclusion pattern
  3. New event tracking methods (tracking.py):

    • track_order_placed(): Tracks order events with order_id, product_name, and optional context
    • track_sso_link_clicked(): Tracks SSO link clicks with provider and redirect URL
    • track_actionable_resolved(): Tracks actionable resolution with actionable_id and type
  4. Version bump: 0.3.0 → 0.4.0

New dependencies

--

Risks

--

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionable.

Unticked items justification

--

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.).
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

Copy link
Copy Markdown
Contributor

@johngathure johngathure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good ✅

@johngathure johngathure merged commit cc2bde3 into wp-media:trunk Jan 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants