Skip to content

Conversation

@juanfer0002
Copy link

Description

Given I didn't find any official support for this to work with extensions that are implementing the manifest v3, I took this approach to support fetch.

There's still work to do here, but this works provisionally while an official solution comes out:

  1. We could support batching, this is only supported if localStorage and XHR is enabled, which isn't true for none of these in SWs
  2. Tests were not implemented, we should definitely implement some

How to use this in your SW:

Given you are likely looking for how to implement this for the new MV3 for Chrome Extension, you can simply download the cjs file under dist (dist/mixpanel.cjs.js), and put it inside your extension, and then import it in your service worker, for example:

import mixpanel from './mixpanel.js'

mixpanel.js

// ... all the code contained in the cjs file

// replace module.exports = mixpanel;
export default mixpanel; 

Then you can use this as you would normally use it.

Evidence

image

This is mainly useful for service workers, which creates compatibility for MV3 chrome extensions
@juanfer0002 juanfer0002 mentioned this pull request Oct 21, 2022
@tday
Copy link

tday commented May 25, 2023

Any updates on this PR being merged?

@catpreneur
Copy link

@tdumitrescu Pls we need this <3

jakewski added a commit that referenced this pull request Oct 30, 2025
* Page leave only when recording heatmap data unless specified (#342)

* page leave only when recording heatmap data unless specified

* fix and add validation test

* dupe test

* somewhat convention

---------

Co-authored-by: Jakub Grzegorzewski <[email protected]>

* build rc

* build non-rc

---------

Co-authored-by: Jakub Grzegorzewski <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants