TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Run Third-Party Scripts from a Web Worker

67 pointsby omarfarooqover 2 years ago

7 comments

earthboundkidover 2 years ago
I tried to use this in production, but it ended up breaking some random GTM tags our marketing firm added to the site, so I had to roll it back. God, I wish I could use it though. I hate the whole idea of GTM. It’s such a crap ecosystem. I’d love to just put it in a sandbox and tell it not to touch anything.
评论 #34157145 未加载
leerobover 2 years ago
Partytown is very exciting. We&#x27;ve been working with the team at Builder to implement it inside the Next.js script component, using the `worker` strategy. `next&#x2F;script` helps you optimize loading third-party scripts, so Partytown was a great fit. Folks at Builder are a pleasure to work with.<p><a href="https:&#x2F;&#x2F;nextjs.org&#x2F;docs&#x2F;basic-features&#x2F;script#offloading-scripts-to-a-web-worker-experimental" rel="nofollow">https:&#x2F;&#x2F;nextjs.org&#x2F;docs&#x2F;basic-features&#x2F;script#offloading-scr...</a>
todd3834over 2 years ago
Very cool! I wonder how they get around all of the “window” related APIs. I imagine you can pollyfill some of them but I would expect some random bugs here and there? I hope I’m wrong because this is otherwise great.<p>This should also be something that providers of 3rd party scripts should take notice of when developing. Why not design to be in a web worker from the start if you can…
评论 #34156650 未加载
jeroenhdover 2 years ago
Looking at the example scripts this tool lists, I wonder if I should just add it to my adblock lists. Seems like an easy solution to block all manner of cyberstalking in a one go.<p>Looks like a good solution to a very strange tool. If your web pages are bogged down by external scripts enough for this to matter, why not get rid of the bloat instead of letting it consume precious battery power in a secondary thread?
no_timeover 2 years ago
&gt;Below are just a few examples of third-party scripts that might be a good candidate to run from within a web worker. The goal is to continue validating commonly used services to ensure Partytown has the correct API, but Partytown itself does not hardcode to any specific services. Help us test and join the conversation in Partytown’s Discord!<p>Google Tag Manager (GTM)<p>Google Analytics (GA)<p>Facebook Pixel<p>Mixpanel<p>Hubspot<p>Segment<p>Amplitude<p>A great selection of scripts which I don&#x27;t want to run under any circumstances.
fulafelover 2 years ago
Sandboxing and monitoring&#x2F;controlling API use of 3rd party scripts sounds really interesting. Are there any limitations of the webworker approach to this? Compared to eg using a js-in-js interpreter.
chrisweeklyover 2 years ago
Partytown seems like such a great idea; it&#x27;s easy to imagine an alternate universe in which something just like it took off and today it&#x27;d be considered nuts not to use it.