You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I want to track some links that lead to external websites using the mixpanel.track_links method. Unfortunately this causes the app to break unless mixpanel.track_links is called within a useEffect (which makes sense) and a setTimeout (which I don't understand).
I want to track the links this way (not using track and using onClick to redirect) because I also want to use the Next.js feature that allows you to prefetch links.
I don't think this is related to the initialization of Mixpanel, since in the reproduction I initialize Mixpanel and then navigate to the page that does not use a setTimeout and it fails
The same issue can be replicated with mixpanel.track_forms
The text was updated successfully, but these errors were encountered:
Hey, I want to track some links that lead to external websites using the
mixpanel.track_links
method. Unfortunately this causes the app to break unlessmixpanel.track_links
is called within auseEffect
(which makes sense) and asetTimeout
(which I don't understand).I want to track the links this way (not using
track
and usingonClick
to redirect) because I also want to use the Next.js feature that allows you to prefetch links.I created a minimal repo reproducing this issue here: https://github.com/nicolassanmar/mixpanel-track-links-next-reproduction
It throws errors when you call
track_links
using either aref
or the element'sid
if you don't call it using a timeout:I don't think this is related to the initialization of Mixpanel, since in the reproduction I initialize Mixpanel and then navigate to the page that does not use a
setTimeout
and it failsThe same issue can be replicated with
mixpanel.track_forms
The text was updated successfully, but these errors were encountered: