JavaScript Library
Beginner PronunciationEN/ˈdʒɑːvəˌskrɪpt ˈlaɪˌbrɛri/
In analytics, a JavaScript library is the browser-side code a site loads in order to record user behaviour and send it to a collection server.
In general usage a JavaScript library means any reusable code package such as React or lodash; in analytics vocabulary it means the web tracking library specifically. It is normally loaded asynchronously from a short snippet, queues calls made before it finished loading, and sends data in batches so the page stays fast. The point where data is most often lost is page unload, so the library must flush its remaining queue with a transport that survives the tab closing.
FAQ
Loaded asynchronously it does not block rendering and its effect on Core Web Vitals is marginal. Slowness usually comes from running several tracking libraries at once, or from placing the snippet as a blocking script in the head, not from measurement itself.
Sources:MDN — Navigator.sendBeacon()