-
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
Incorrect url in Piwik when use hashHistory from react-router #39
Comments
have you seen and applied the post in the piwik faq? https://piwik.org/faq/how-to/faq_188/ |
Yes, but this is not my case because url sended to piwik not contain hash. After analyze code and testing when i add remove initial slash
before line https://github.com/joernroeder/piwik-react-router/blob/master/index.js#L58 |
if i understand you right, your main problem is the loos of the
https://github.com/ReactTraining/history#using-a-base-url Alternatively you could proxy the hope that helps! cheers jörn |
@regdos after thinking about the proxy/modifier today i found other use cases to modify the location (e.g. to add campain parameters or state from outside react). I've ended up adding the functionality of History Modifiers directly into |
@regdos could you resolve the issue? I'm closing this issue for now as the possibility to manipulate the current location before it gets passed to the tracker exists in the module since this version ( Thanks for opening this issue as it leaded to a new useful feature of this module and feel free to reopen it if you need any help. cheers |
Come across the same problem, as @joernroeder said, I just pass a modifier to const modifier = function (location) {
const loc = window.location;
location.path = `${loc.origin}${loc.pathname}${loc.hash}`;
return location;
}; |
Page url address - https://domain.com/context/#/form?lang=en
In Piwik url register as https://domain.com/form?lang=en
I use hashHistory from react-router in my app.
piwik-react-router send
push(['setCustomUrl', currentPath])
, currentPath is calculate ascurrentPath = urljoin(loc.pathname, loc.search)
and for my url currentPath is /form?lang=enPiwik calculate url https://github.com/piwik/piwik/blob/3.x-dev/js/piwik.js#L3275 and when url is absolute add only schema and host
and i get my incorrect url https://domain.com/form?lang=en
Solving the problem would be for example remove initial slash depending on the parameter.
What do You think about it?
The text was updated successfully, but these errors were encountered: