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

What's the correct way to track_pageview on a SPA project? #377

Open
sabres207 opened this issue May 23, 2023 · 2 comments
Open

What's the correct way to track_pageview on a SPA project? #377

sabres207 opened this issue May 23, 2023 · 2 comments

Comments

@sabres207
Copy link

"mixpanel-browser": "^2.45.0",
"react": "^17.0.1"

I have a react project, and I understand the track_pageview flag is not designed to work for a single-page application.

I've seen you write to call directly too mixpanel.track_pageview(), but I don't find it in the docs, and it doesn't work.
I see in the source code it just calling track() with some information about the current url, but thought maybe I'm missing something here.

Thanks.

@tdumitrescu
Copy link
Member

Hi, track_pageview() is available from v2.47.0 and above (https://github.com/mixpanel/mixpanel-js/releases/tag/v2.47.0). Docs are here: https://docs.mixpanel.com/docs/tracking/reference/javascript#tracking-page-views. It does appear that it hasn't made it into the API reference doc yet, we'll get that fixed, thanks.

@sabres207
Copy link
Author

Thanks for the quick helpful reply!
If you are already here :)
I didn't understand the difference between register() and adding properties via people.set

What would be better, let's say right after a user is logged in and I call identify() and want to add his group / plan / other properties.

Thanks!

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

No branches or pull requests

2 participants