While some tags are created by website operators and served from the same domain as the webpage, most tags are created by third parties and served from remote servers. In some instances, website operators can point a subdomain to a third party server by creating a CNAME record in DNS to make a third-party tag appear like a first-party tag.
When a user visits a webpage, tags are loaded in the browser. Sometimes, a tag management system like Mezzobit is used, which employs a container tag to bootstrap the loading of other tags. When a TMS is not used, the tags are usually embedded in the page directly or called from other tags in a process called tag chaining.
Tag chains can get very long and unwieldy, either when a single tag brings in a lot of child tags or there is a long sequence of tag chains, sometimes stretching 10-15 generations deep. Below is a typical example showing both. The only practical limit to either would be the capabilities of the visitor's browser and bandwidth.
- Examine nearly any data element in the browser, such as what content the user is viewing, what website was just visited, or characteristics of the local machine.
- Create new visual elements on the page or change existing elements.
- Perform tracking functions, such as dropping or reading cookies, using local storage, or performing browser fingerprinting.
- Call other scripts, either first or third party.
- Examine and control other code in the page, with some limitations.