Microsoft cuts 4.5% from Clarity script that runs on billions of pages

Microsoft cuts 4.5% from Clarity script that runs on billions of pages

By Luis Rijo
Publication Date: 2026-11-01 22:26:00

Microsoft has made clarity.js, the JavaScript file that powers its free Clarity behavioral analytics product, 1,257 bytes smaller in compressed form, a reduction of 4.5%, according to a post on the Clarity blog dated October 29, 2026. The work was carried out by an AI coding agent that ran more than 50 build-and-test experiments, keeping changes that shrank the file and reverting the rest. The largest single saving it found, 2,308 bytes, was never shipped: it would have broken Angular websites that rely on a library called Zone.js.

In Short

Microsoft made the little program that its Clarity analytics tool puts on websites about 4.5% smaller, using an AI helper that tried dozens of small code changes and kept only the ones that worked. That program loads on billions of web pages, so even a small trim means less code for every visitor’s browser to download. An even bigger cut was possible, but Microsoft left it out because it would have quietly broken some websites built with…