Skip to content

Remove broken sessionReplay code - #25

Merged
serenackuo merged 8 commits into
masterfrom
skuo/remove-tracking
Aug 19, 2026
Merged

Remove broken sessionReplay code#25
serenackuo merged 8 commits into
masterfrom
skuo/remove-tracking

Conversation

@serenackuo

Copy link
Copy Markdown
Contributor

Since the Webflow custom code that used to define window.sessionReplay was removed in favor of GTM-managed init, a leftover call in src/tracking/experiment.js throws TypeError: Cannot read properties of undefined (reading 'plugin') on every page load, which lines up with the ~98% drop in [Amplitude] Page Viewed events on www.modular.com since July 24–25.

Changes in this PR:

  • Remove the dead window.sessionReplay.plugin(...) call from src/tracking/experiment.js
  • Remove the dead window.amplitude.init(...) call from the same block (GTM now owns init, gated on consent)
  • Leave initAmplitude() in src/tracking/amplitude.js untouched — it only calls .track() and is safe either way
  • Rebuild dist/

Next steps to confirm the fix:

  • Deploy and check the console for the .plugin TypeError — should be gone
  • Confirm window.amplitude._iq populates on page load with consent granted (was still empty as of the last GTM-side check)
  • Confirm a POST to Amplitude's collection endpoint appears in the Network tab
  • If tracking is still broken, revisit the {{Amplitude Config}} GTM variable (currently a Constant, should be Custom JavaScript)

Comment thread src/tracking/experiment.js Outdated
@@ -32,12 +32,6 @@ export function initExperiment() {
}

waitUntil(() => window.amplitude).then(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will this just cause a timeout on every page if the user declined cookies?

@serenackuo
serenackuo merged commit e31d39d into master Aug 19, 2026
3 of 5 checks 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