-
Notifications
You must be signed in to change notification settings - Fork 312
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
Can't integrate Mixpanel in a chrome extension under manifest v3 #438
Comments
I'm having the same issue. #304 has some ideas on how to work around this. I'm currently debating using the code in that issue or just using the ingestion API and writing the client myself |
Probably depends on which exact config you pass to mixpanel, based on those it may or may not attempt to access |
Interesting. Do you know which config could be changed to prevent accessing document? I don't pass any specifc config upon initializing. I call init like this: mixpanel.init("TOKEN", {api_host:"https://api.mixpanel.com"}); |
You can check the source to see what's happening, but I don't think it's a good idea to try to guess this. You would essentially be relying on the internal implementation details of the library. It's better to use the ingestion API, it's not hard. Take a look at https://developer.mixpanel.com/reference/track-event |
My comment here #304 (comment) gives you a good idea of why mixpanel doesn't work in MV3. The issue isn't just DOM access. |
Hey, there is something else that I think it's worth mentioning. I have an extension and I use it to inject a content-script in the dom. I can't use this library in the content script because it injects external code, which is not allowed. I received a Blue Argon strike from the chrome dev team (Blue Argon docs).
I updated to v2.55.1 and that snipped is gone, but external script injection is still present in the bundle, I suppose it's just a matter of time before this one gets flagged as well: mixpanel-js/src/mixpanel-core.js Line 702 in 475b2c6
var script = document$1.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.defer = true;
script.src = url;
var s = document$1.getElementsByTagName('script')[0];
s.parentNode.insertBefore(script, s); |
Any updates on this? Would be great if someone from Mixpanel can confirm if Mixpanel-browser library works in a service worker in an MV3 browser extension or not. |
Im migrating a chrome extension from manifest v2 to manifest v3, which moves from background pages to service workers. As service workers don't have access to DOM, window, or document, loading mixpanel library now causes an error 'document undefined'.
Is there any solution to integrate Mixpanel in a chrome extension now that MV2 is deprecated?
The text was updated successfully, but these errors were encountered: