-
Notifications
You must be signed in to change notification settings - Fork 146
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
Shipping Countly In a WebWorker Context #382
Comments
Hello. Which features are you using in your integration? |
Thanks @ArtursKadikis, if there was a switch that would be a nice short-term fix, whether it meets the expectation can only be validated in the webworker context. WebWorkers also don't allow The reason this will be short-term fix is because it will still bloat the bundles with all the unreachable code. So the ideal solution would be some sort of modularization that would allow for tree-shaking all unreachable code. |
Also @ArtursKadikis, just so it's clear, any Countly users who use Countly within browser extensions are going to hit this same issue with the MV3 migration that is underway in the Chromium ecosystem. Addressing this issue will be a benefit beyond @whizzzkid and the ipfs-companion project. Thanks a lot. |
@ArtursKadikis : is there any sense of timeline for addressing this? Some info (even if rough) is better than none. For example would this happen in a month, in 2023Q2, by end of the year? I'm asking so we can plan our work accordingly. I'd ideally like to be staying on countly SDKs but given the last shared dates in March of Chrome webstore rejecting extensions that aren't MV3 compatible, we may have to roll our own client SDK. |
@ArtursKadikis the main thing I think many users would like to see is a version of the countly sdk that works in both node and the web. i.e. an ESM module, that doesn't include side-effects (not kicking off the IIFE). However, for the sake of getting this resolved; Simply removing the IIFE, and using dependency injection should resolve many of our current problems as well as future issues without being too much of a burden on your team. |
@SgtPooki I'm not sure if that helps your specific usecase, but we already have a SDK that targets specifically NodeJS: @BigLep on the timelines this currently seems more of a Q2 - Q3 kind of thing. This would include taking care of the |
@ArtursKadikis any update on the removal of the window object and making the web SDK more webworker friendly? |
@SgtPooki Unfortunately, other priorities took over, and we did not have time to focus on web SDK for a while. Currently, we are looking into creating a new JS SDK that would be able to work in broader contexts. |
@turtledreams thanks for your feedback, I patched the sdk like so: https://github.com/ipfs/ipfs-companion/pull/1232/files#diff-a05913488f8fc1e2aa8f1c8f051438b7f05e9dca1ad8d185b793d48dfa6099cb This seems to be able to ship metrics to countly. What doesn't work:
And, that's fine, because what we need is building blocks for shipping metrics, the other functionality is nice to have or not needed in the webworker context. As @SgtPooki mentioned before: |
Hi, Also, we extended the storage methods so you can provide your own. If you encounter any issues, please let us know. Current documentation on the topic: https://support.count.ly/hc/en-us/articles/360037441932-Web-analytics-JavaScript-#h_01HH1BABFQ48FKWGJCX9HFMKW8 |
Hello, Looks like it should be working in a web worker context. Will be closing this for now. |
Hello Team
We are using countly (wrapped inside
[ignite-metrics](https://github.com/ipfs-shipyard/ignite-metrics/)
) in[ipfs-companion](https://github.com/ipfs/ipfs-companion)
. We are in process of migrating to Chrome manifest v3 and are facing issues with bundlingcountly-sdk-web
with respective shims and browserfied counterparts in awebworker
context.Manifest V3 expects the background page to be a
webworker
which means no access to DOM/window objects and using onlyfetch
api to request resources. However,countly-sdk-web
does not ship with tree-shakable modules, which would remove direct dependency onwindow
object. As we're not using all the features of the SDK, and it gets bundled in it's entirety.I see #75 wanted to tackle something along those lines but has not seen much traction. Any guidance on this would be appreciated. In the meantime, we've resolved to including the entire sdk on pages with window context.
Thanks
The text was updated successfully, but these errors were encountered: