-
Notifications
You must be signed in to change notification settings - Fork 99
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
Toolbar loads incorrectly when using multiple posthog instances #1172
Comments
Oh, the warning is not about Nevertheless, I have two toolbars on the same page, both showing exactly the same data, and both always showing one on top of each other. Despite the warning, heatmap data obviously is displayed. As for the instance config, the full-blown uses:
And the anonymous is using this (they both use the same token, but have different distinctID):
You can see it in action on https://www.mycapitally.com/ |
Thanks so much for the extra context. I get what you mean now by the error message. In which case, yeah I think disabling it for the other instance makes sense. I have two separate but related ideas:
// uses the standard distinct_id
posthog.capture("my-event");
// uses the given distinctId and doesn't affect any of the stored state
posthog.captureStatless({ distinctId: "shared-id", event: "my-event", properties: {}}) |
The idea to just bail-out makes sense to me. I don't see much sense in having two toolbars on one page. Btw, if there is more than one project in use, the toolbar could have project selector - obviously if this ever becomes an issue. As for the second, that would actually be great, but it would need to meet a few requirements:
In general, I think having a standardized way to be able to do anonymous captures would be great. As currently you either have to be fully anonymous, or fully tracking. I'm moving from Mixpanel where I have this setup and it's working great so far, but couldn't find anyone else doing the same 😂 |
From #1163 @panrafal
@benjackwhite Sure, there are basically two issues here:
I have two instances of Posthog reporting to the same project. One is using all bells and whistles and is capturing only once user gives their consent. It reports heatmaps, autocapture, recordings, etc. The second instance is for manually capturing anonymous actions - with a shared distinct_id. They're separate, so that non-anonymous tracking doesn't leach out by accident to the anonymous actions.
When the two toolbars show up, one of them displays a big warning that it doesn't work because decide is disabled. It does display data though, but only because it's being capture by the second instance. As toolbar stores it's preferences on a single localStorage key, touching any of the toolbars will overwrite the other one. They're simply not very compatible with multiple instances.
As for solutions...
For 1) - it's very specific to my use-case. This PR, while fixing nr 2, solves my main issue. I could also refactor it to just accept an option, like disable_toolbar.
For 2) - now as I'm thinking of it, the warning probably is too excessive and it lead me to believe it won't work without decide. Debugging or creating actions do make a lot of sense even without it.
So I'd propose to add the disable_toolbar option, or add the projectId to the toolbar storage key, ensuring at the same time, that there's only one toolbar active per projectId. The second is probably more sound, but the first I believe would be much efficient to implement.
Sounds like we need to fix the clashing localstorage keys or something, rather than adding more config options. I want to be sure that will solve it so just need a few more details on how to reproduce.
The text was updated successfully, but these errors were encountered: