-
Notifications
You must be signed in to change notification settings - Fork 22
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
Page title updating past track event? #45
Comments
Hey @JimmyMultani , that's an interesting use case! As it seems that this is an open and solvable issue on react-helmet i suggest temporary not to connect to the // @see https://github.com/ReactTraining/react-router/blob/master/FAQ.md#how-do-i-access-the-history-object-outside-of-components
const history = ...
onChangeClientState: () => {
// eventually check the current title against a previous one before sending the track event
piwikReactRouter.track(history.location)
} hope that helps. jörn |
@JimmyMultani could you solve your issue? |
In case someone is still wondering, this works. To make it even more convenient, I created a custom /* components/Helmet.js */
import React from 'react';
import Helmet from 'react-helmet';
import history from '../history';
import analytics from '../analytics';
const onChangeClientState = () => analytics.track(history.location);
const CustomHelmet = ({ children }) => (
<Helmet onChangeClientState={onChangeClientState}>
{children}
</Helmet>
);
export default CustomHelmet; |
I'm having a bit of trouble with having
react-helmet
work withpiwik-react-router
. As listed in this issue,piwik-react-router
is not waiting until the page renders before sending a track request. This results in the request having an incorrectaction_name
(or document title) being sent.Any assistance in this matter would be greatly appreciated. Thanks!
The text was updated successfully, but these errors were encountered: