Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matomo tracker load fix #1127

Merged
merged 1 commit into from
Oct 21, 2024
Merged

Matomo tracker load fix #1127

merged 1 commit into from
Oct 21, 2024

Conversation

jesperengstrom
Copy link
Contributor

Description

Solves

I've discovered a bug in the Matomo implementation. Sometimes initMatomo is called before the matomo.js script has loaded, causing the whole thing to fail silently and nothing is logged (until a page reload - when the script is probably cached). Try it out by opening a fresh incognito tab and visit beta-dev a couple of times.

Summary of changes

We need to setContext during component initialization, but we can update it with the tracker when the script is ready. Here using an on:load handler. Also doing a trackPageView in the init function so we don't miss to track the first page load.

@jesperengstrom jesperengstrom marked this pull request as ready for review October 18, 2024 13:21
Copy link
Contributor

@johanbissemattsson johanbissemattsson left a comment

Choose a reason for hiding this comment

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

LGTM!

@jesperengstrom jesperengstrom merged commit 8986834 into develop Oct 21, 2024
2 checks passed
@jesperengstrom jesperengstrom deleted the matomo-fix branch October 21, 2024 11:50
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