T3150 utm refactor#327
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors UTM tracking by integrating Odoo's utm.mixin and simplifies the sponsorship controller by removing manual UTM extraction and adopting model converters. However, feedback highlights that utm.mixin in Odoo 14 does not automatically populate fields on creation, which could lead to tracking data loss since the manual extraction logic was removed. Additionally, using request.httprequest.full_path for login redirects is flagged as a risk during AJAX updates, as it could redirect users to a JSON endpoint; a more stable redirect path construction is recommended.
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.
T3150: Refactor UTM Tracking (and fix WordPress sponsorships)
LINKED TO PR: CompassionCH/compassion-switzerland#1753
Follow-up to T3090 (PR compassion-website #321 and compassion-switzerland #1751.
The Issue
The initial UTM tracking implementation introduced a critical bug:
<model>to<int>broke our all QR printed slug based link.utm.mixinfunctionality which already handles all of this natively via cookies.The Solution (Refactored & Simplified)
This PR removes the redundant code and leans on Odoo's UTM utility.
<model("compassion.child"):child>route: This fixes the WordPress related links. It also ensures backward compatibility, meaning slug-based links and integer-based links will work.utm.mixininheritance torecurring.contract. Now, Odoo automatically intercepts UTMs from the URL, stores them in cookies, and maps them to the contract upon creation./web/loginround-trip.compassion-switzerland) Refactored the QR URL builder to useurllib.parse.urlencodefor safer parameter construction.Here is how it works:

The code has been tested locally on the different possibilities.