Increase App Performance — Tame Tag Managers and Take Back Control From Third-Parties

Zack Jackson
The Startup
Published in
12 min readOct 6, 2020

--

Javascript application performance can be tricky, even if the application has been well-tuned for speed — there’s a big area that engineering does not own and has little control over.

It’s the tag manager and third party code in general.

I can get an app to load and finish in 2 seconds. But with all the vendor code, the reality is usually a 2–3 additional seconds. There’s not much room for improvement left within the JS app itself.

There’s two Passions I have. Architecture and performance

I refused to accept that It could not be improved by engineering, without getting involved in rebuilding the rule sets and code inside of a tag manager. So I started working out how to gain control over third party code at runtime.

I primarily use Adobe Launch, so moving forward, I’ll be referencing Launch and it’s internals. For the record, I’ve got nothing against Launch — all tag managers are equally terrible.

For more generic perf writings, give this a read:

What causes vendor code to easily end up slower than the core application?

Bad timing, over-aggressive use of tag managers, too many localStorage, DOM, and Cookie manipulation.

Vendor scripts usually have long request chains, calling several domains, loading additional scripts. Every new origin requires a DNS lookup and TCP connection. This handshake can range from 20ms to 200ms depending on the vendor CDN and what pressure the vendors own network is under. Other steps like HTTPS handshakes will also increase connection time.

Some vendor scripts will bring jquery, iframes, angular apps. One vendor can pull down 2mb of JS over its request chain. Since vendor tags and tag managers do not coordinate with applications, a lot of code is executed early — just in case.

--

--

Zack Jackson
The Startup

Infra Architect @ ByteDance. Creator of Module Federation. Specializing in Bundler and Javascript Orchestration at scale.