UTM install time injection & GTM Data Layer push#14130
Conversation
…to stop pollution of GA4 data Clean URL during browsing Remember where the click came from - Store the reference in redux Inject UTM at install time only - you click "Add to Firefox", right before Firefox's install API is called, we silently update the URL using history.replaceState(). Firefox reads this and records the attribution. Clean up after install — Once the install completes (or fails/cancels), we silently remove the UTM params from the URL again. External UTM params are untouched — If someone arrives from an external link like ?utm_source=blog.example.com, we never overwrite those. Firefox reads them directly.
On Addon Detail page, push the following variables to GTM datalayer for analytics reporting and dashboard - Addon Type - Page Locale
Updated tests for the push page variables to GTM data layer functionality
Updated all `amo/tracking` Jest mocks across the entire test suite to include `setPageVariables`
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14130 +/- ##
==========================================
- Coverage 98.13% 98.12% -0.01%
==========================================
Files 265 267 +2
Lines 10648 10714 +66
Branches 3285 3304 +19
==========================================
+ Hits 10449 10513 +64
- Misses 186 188 +2
Partials 13 13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
In #14089 you said:
And then you closed the PR. Could you elaborate on why this is necessary ? |
We discussed options with our GA team and they said GA4/GTM filtering is unreliable and can cause other issues with analytics reporting. Their recommendation was to make the change at the app level so that the incorrect data never hits Google Analytics. |
|
I'm not done testing this yet, but I noticed something: GA's Is that going to be an issue in the reporting in GA? |
diox
left a comment
There was a problem hiding this comment.
This appears to be working at least for the primary hero, but as I commented I'm not sure what the impact of replaceState dance will be in GA...
Regardless, it needs quite a few tests around the primary hero/secondary hero changes + the new install attribution stuff: You have modified tests to ensure URLs are now "clean" but I don't see tests ensuring we are keeping track of the attribution in the redux store, or tests around installation and history manipulation to inject and remove the attribution params.
|
FWIW, inspecting
I haven't tested yet if that actually translates to correct attribution in Firefox itself when it works. |
- Added additional test coverage for the UTM params injection/removal functionality - Added UTM params removal for event.target.error === ERROR_CORRUPT_FILE case
|
Added the following test coverage Reducer (test_addoninstallSource.js)
Core logic - injection and cleanup (test_installAttribution.js)
Install lifecycle (TestInstallButtonWrapper.js)
|
|
Also discussed the other concerns with GA team. They advised that |
|
@diox - The test coverage has been expanded and is back to repo baseline |
|
@amit-fytq I'm still having the issues I mentioned above. could you add functional tests ensuring install attribution is done correctly when clicking the primary hero, secondary hero, other shelves and search results ? |
@diox - I am not sure what you mean by "install attribution" in the context of this UTM params removal PR? Do you mean Firefox telemetry attribution? |
|
No, I mean the injection of the attribution source at install time |
That is covered by the new tests which were added in the latest commit |
|
Those test cover individual component behavior. I'm interested in having functional tests that start from displaying the primary/secondary hero or shelves on the homepage, or search results, and end up with an install. There is no coverage for that currently ( As I said above I could only get the end to end attribution to work properly with the primary hero, so something looks broken somewhere - having tests for that flow would help prove that it's working properly in all those cases. |
|
@diox It seems the SearchResult component is invoking I'll fix this |
- Fixes to SearchResult component to properly dispatch setAddonInstallSource to Redux - Added functional tests
|
@diox please review |
Fixes #16178
Remove utm_ query parameters from internal AMO links while browsing to stop pollution of GA4 data*
Push page variables to GTM datalayer