Third-party JavaScript is the one addition to a site that developers should refuse outright. That position reads as fringe today, yet it would once have passed as ordinary caution. The request here is simply that third-party scripts be treated the way third-party cookies now are: as a mistake we are in the process of correcting.

How the web ended up stateful

Originally the web carried no state at all. A client asked a server for a resource, the server answered, and both sides immediately forgot the exchange. Shopping carts and logins were impossible under those conditions, which is why cookies were introduced. Looking back, cookies should have been constrained by a same-origin policy from the very first day. Authentication and commerce would still have worked, and the large security hole that has been used to follow people across sites would never have opened. The web swung from having no state to having far too much.

Browsers are now closing that hole, at least for cookies. Chrome is slow to act because the same company builds the browser and runs an advertising business, but even it cannot hold back the shift. Third-party cookies exist almost solely for tracking — that was never the intent. The same treatment should extend to third-party JavaScript.

Scripts execute; other assets don't

Any third-party file you pull into a page — an image, a stylesheet, a font — is a possible tracking vector. Third-party JavaScript goes further, because it can execute arbitrary code. Every script on your site therefore grants someone else permission to run code inside your pages, which is a remarkable thing to agree to.

Worse, the code you invited in can itself fetch other third-party scripts. A single small analytics snippet or Google Tag Manager include may look harmless, but adding it hands your keys to a stranger who then invites in all their disreputable contacts. Request Map Generator makes this visible: paste in the URL of a news article or magazine piece and watch how many third-party scripts arrive through one tiny script element on the original page.

The obstacle is organizational

Avoiding third-party scripts is easier said than done, particularly on a site whose business model depends on third-party tracking. That model will not change unless the people who build sites engage in a campaign of passive resistance. The obvious personal risk is retaliation: refuse to add the script and management may simply hand the task to someone else and show you the door.

Individual refusal only works when everyone refuses together, and workers back one another up in the workplace through a union. So the answer to what one thing people can do to make their website better is to unionize.