But I get no events sent, It is almost like is not firing. I see using break points that the code is being hit. Is there any consideration I am missing considering this code is running inside of a service worker of a Chrome Extension V3. Thanks for your help
I don’t think the browser tracker works in ServiceWorker environments; these don’t usually have XMLHttpRequest defined, and the logic for sending events in that scenario skips straight to new Image() as a fall back, and that’s also probably not supported since there’s no DOM. (I’m not sure if navigator.sendBeacon() would work, but the current implementation doesn’t even try if XMLHttpRequest isn’t detected).
Ideally browser-tracker-core would try to use fetch and fall back to XMLHttpRequest or try sendBeacon independently but until then you might be stuck with using tracker-core directly and using your own “emitter” built using the fetch() API, or forking browser-tracker & browser-tracker-core to adjust the logic to untangle the assumption that sendBeacon wouldn’t exist without XMLHttpRequest.