I was forced to add GTM to a site because it meant marketing could just hand over the GTM login and a pile of money to another company which could then provide them with pretty reports on what the customers were doing. The analytics company promised to not do anything bad so it was OK.
And that was after an incident where the entire site was turned purple by another external JavaScript...
lol, what was the root cause? Defacement/scriptkiddie attack or a "background covering" ad that did not recognize the content area and paint over the whole screen instead?
Around a year later the site changed color when their script started injecting a new stylesheet into our site. They never really said what happened only that they had restored the old version of the script. Maybe some developer pushed dev code to the old production url or maybe they were hacked.
It got really crazy with google analytics and then all social beacons. Now the only limit are the CPU and RAM available to the browser.
... and in Germany, the data cap if you're on mobile. Video ads with autoplay, tons of trackers, no wonder I regularly hit 3GB a month, which is actually the biggest package my provider offers.
Rest assured the majority of (web) developers does not like this crap a bit. Most of the pressure to add hundreds of analytics toolkits, trackers or these snoopers come from marketing - they (or worse, the C-level execs) get convinced that they need to integrate tool XYZ to "stay competitive" or "improve their customer retention" or whatever buzzword goes today, and the devs at the bottom of the chain are left to implement it.