-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat(routeChangeComplete events): set referrerUrl and customUrl on routeChangeStart so it can matomo events can be used early on page load (e.g. in a react useEffect) with the correct values #72
Conversation
…eChangeStart so it can matomo events can be used early on page load (e.g. in a react useEffect) with the correct values
Codecov Report
@@ Coverage Diff @@
## master #72 +/- ##
=======================================
Coverage 85.00% 85.00%
=======================================
Files 1 1
Lines 60 60
Branches 16 16
=======================================
Hits 51 51
Misses 1 1
Partials 8 8
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Top la PR !
J'ai détecté ce que je pense être un bug sur les URLs exclues avec l'envoie d'un event mais le bug était déjà présent avant :)
@@ -80,35 +80,37 @@ export function init({ | |||
} | |||
previousPath = location.pathname; | |||
|
|||
Router.events.on("routeChangeStart", (path: string): void => { | |||
if (isExcludedUrl(path, excludeUrlsPatterns)) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quand le path est à exclure, cela signifie que l'on ne met pas à jour les données de matomo.
Je pense que ce if
n'est pas à faire dans ce cas précis. On va avoir un comportement étrange quand on va envoyer un event à motomo car il va se baser sur l'ancienne URL vu que l'on n'aura pas mis à jour les données.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
effctivement. c'était comme ça avant donc j'imagine que ce choix est conscient ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oui, cela fait référence aux url qu'on exclue du suivi matomo. Or, là où je trouve la chose tricky, c'est si on passe d'une url exclue à une url non exclue, cela ne settera pas correcment le referrerUrl
, non ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ca mettra la derniere url non blacklistée en referrer oui;
ca me parait correct
@@ -77,6 +87,43 @@ describe("push", () => { | |||
}); | |||
}); | |||
|
|||
describe("router.routeChangeStart event", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Top les tests 👍 (sans snapshot, la vie est plus folle 🎉 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
franchement ouai 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes c'est niquel ça !
peut-être tester avec la logique d'exclusion d'url aussi pour être sûr que ça ne fasse pas des trucs bizarres
@@ -80,35 +80,37 @@ export function init({ | |||
} | |||
previousPath = location.pathname; | |||
|
|||
Router.events.on("routeChangeStart", (path: string): void => { | |||
if (isExcludedUrl(path, excludeUrlsPatterns)) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oui, cela fait référence aux url qu'on exclue du suivi matomo. Or, là où je trouve la chose tricky, c'est si on passe d'une url exclue à une url non exclue, cela ne settera pas correcment le referrerUrl
, non ?
@@ -77,6 +87,43 @@ describe("push", () => { | |||
}); | |||
}); | |||
|
|||
describe("router.routeChangeStart event", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes c'est niquel ça !
peut-être tester avec la logique d'exclusion d'url aussi pour être sûr que ça ne fasse pas des trucs bizarres
Merci pour les corrections ! |
Avec plaisir. Je peux faire ça depuis ma PR ? |
I'd love for this to get merged and released. |
lets do this |
# [1.3.0](v1.2.2...v1.3.0) (2022-03-10) ### Features * **routeChangeComplete events:** set referrerUrl and customUrl on routeChangeStart so it can matomo events can be used early on page load (e.g. in a react useEffect) with the correct values ([#72](#72)) ([52f2bbc](52f2bbc))
🎉 This PR is included in version 1.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Inside a next and react app, if we push event to matomo on a
useEffect
, after a routeChange, the values sent are the old one as currently we set the values on therouteChangeComplete
.This PR allow to set the needed values on the
routeChangeStart
so they can be used early