concept third - party script in category javascript

This is an excerpt from Manning's book Third-Party JavaScript.
One of JavaScript’s most powerful features is that it enables developers to capture and respond to user events as they occur on a web page. For example, you can write JavaScript to respond to a website visitor’s mouse movements and/or mouse clicks. Third-party scripts are no exception: they too can observe browser events and capture data about how the visitor interacts with the publisher’s page. This might include tracking how long a visitor stays on a page before moving on, what content they saw while they were reading the page, and where they went afterward. There are dozens of browser events your JavaScript code can hook into from which you could derive hundreds of different insights.
So far we’ve been looking at third-party scripts from the context of a content provider. Let’s change perspectives. As developers of third-party JavaScript, we author scripts that we intend to execute on a content provider’s website. In order to get our code onto the provider’s website, we give them HTML code snippets to insert into their pages that load JavaScript files from our servers (see figure 1.2). We aren’t affiliated with the website provider; we’re merely loading scripts on their pages to provide them with helpful libraries or useful self-contained applications.
Figure 1.2. A script-loading snippet placed on the publisher’s web page loads third-party JavaScript code.
![]()
If you’re scratching your head, don’t worry. The easiest way to understand what third-party scripts are is to see how they’re used in practice. In the next section, we’ll go over some real-world examples of third-party scripts in the wild. If you don’t know what they are by the time we’re finished, then our status as third-rate technical authors will be cemented. Onward!