← Blog·Analytics Implementation

Analytics Implementation

Web tags: what they are and how website tagging works

What a web tag is, what one looks like, the request it sends, how it differs from meta and HTML tags, and what breaks when tags go unwatched.

David PombarSwiss army knife at Trackingplan
6 min read · 1234 words

A web tag is a small piece of JavaScript on a website that collects data about a visit and sends it to a third-party tool, such as Google Analytics, Meta, or a heatmap vendor. Website tagging is the work of adding those tags, deciding what each one sends, and keeping them correct as the site changes.

Every analytics report, every conversion an ad platform optimizes for, and every audience you retarget starts as a request a tag sent from a visitor’s browser. If the tag is missing, fires twice, or sends the wrong value, the report is wrong, and nothing in the report tells you so.

What a web tag looks like

Most tags are a few lines you paste into the page, or that a tag manager injects for you. This is the Google tag for GA4:

<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXX');
</script>

The code is not the interesting part. The request it sends is. When the page loads, the tag sends something like this to Google:

https://region1.google-analytics.com/g/collect
  ?v=2&tid=G-XXXXXXX&en=page_view
  &dl=https://shop.example.com/pricing
  &dt=Pricing

That request is called a hit. en is the event name, dl the page location, dt the page title. Every tag works the same way: it reads something about the page and the visitor, then sends it to its vendor as a URL or a payload.

How website tagging works

A page view with tags on it goes through four steps, usually in under a second:

  1. The page loads the tag. Either directly from the HTML, or through a tag manager container that loads many tags at once.
  2. A trigger decides when it fires. On page load, on a click, on a form submit, on a purchase confirmation.
  3. The tag reads its data. From the URL, from cookies, and above all from the dataLayer, the object where the site publishes the values tags need: the product, the price, the order ID, the user’s consent.
  4. The tag sends a hit to the vendor. The vendor stores it and turns it into reports, audiences, or bidding signals.

Steps 2 and 3 are where tagging goes wrong. The tag is installed, so everything looks fine. It just fires at the wrong moment or reads a variable that no longer exists.

Types of web tags

TypeWhat it doesExamples
Analytics tagsRecord page views and events for reportingGA4, Adobe Analytics, Amplitude, Mixpanel
Advertising and conversion pixelsTell an ad platform that a visitor converted, so it can attribute and optimizeMeta Pixel, Google Ads, TikTok, LinkedIn Insight
Consent tagsShow the banner and pass the visitor’s choice to the other tagsOneTrust, Cookiebot, Didomi, Usercentrics
Experience tagsRecord sessions, heatmaps, or run testsHotjar, Microsoft Clarity, FullStory, A/B testing tools
Server-side tagsReceive hits on your own server and forward them to vendorsServer-side GTM, Meta Conversions API

“Pixel” is the older name for a conversion tag. It comes from the 1×1 image ad platforms used to load before JavaScript tags took over; pixel tracking covers the difference.

Web tags vs meta tags vs HTML tags

Three things share the word, and searches mix them up all the time.

Web tagMeta tagHTML tag
What it isJavaScript that sends data to a third partyA <meta> element in the page headAny element of the page’s markup
Who reads itAnalytics and ad platformsSearch engines and social networksThe browser
ExampleThe Meta Pixel<meta name="description" content="…"><p>, <a>, <img>
What it is forMeasurement and marketingHow the page appears in search and when sharedStructure and content

This post is about the first column. If you are here for the <meta> description, you want an SEO guide instead.

Tag management systems

A site with five tags can live with them in the HTML. A site with fifty cannot. A tag management system (TMS) such as Google Tag Manager, Tealium, or Adobe Tags holds every tag in one container, with its triggers and variables, so marketers can add and change tags without a code release.

That speed is the point, and also the risk. A TMS makes it easy to publish a change, not to know what the change did to the data. What is tag management covers how a TMS is organized.

What goes wrong with web tags

Tags fail quietly. The page works, the visitor notices nothing, and the data is wrong for days or weeks. The usual failures:

Even a correct tag can lose data. In one enterprise case, the tag was right and the data still went missing because of timing: “You can have a perfectly implemented tag, in the right place, firing the right event, and still lose most of your data.” (the full story).

How to keep tags working

Checking tags in the browser, or with a tag assistant, tells you what one page sends in one session. It does not tell you what changed after Tuesday’s release.

Trackingplan works where your data is produced: the hit, the dataLayer, the SDK, the pixel, the CAPI payload, the consent state, the GTM release. It reads the requests your real visitors already send and catches missing properties, dead tags, duplicate fires, broken triggers, naming inconsistencies, and orphan events on real traffic, with links to the affected hits. More on that in monitoring.

FAQ

What is a web tag in simple terms?

A few lines of code on a website that tell a third-party tool what a visitor did, such as viewing a page or buying something.

What is tagging in web analytics?

Adding the tags that send each page view and interaction to an analytics tool, and deciding which events and parameters each one carries. The tracking plan lists them, and a tag manager deploys them.

What is the difference between a tag and a pixel?

A pixel is a kind of tag. The word comes from the invisible 1×1 image early conversion tags used. Today most “pixels”, such as the Meta Pixel, are JavaScript tags.

A tag is code that runs and sends data. A cookie is a small file the browser stores. Tags often set or read cookies, for example to recognize a returning visitor, which is why consent rules apply to both.

Do web tags slow down a website?

Each tag adds requests and script execution. Loading tags asynchronously, through a single tag manager container, and removing the ones nobody uses keeps the cost low.

How do I know if my tags are firing correctly?

Open the browser’s network panel, or a tag debugger, and check that each tag sends a request with the values you expect. To know that stays true after every release, monitor the hits on real traffic.

David PombarSwiss army knife at Trackingplan

Read more from David, a Senior Product Strategist with 18+ years in digital product development and an atypical error detection knack.

Read next

All Blog →

Trackingplan

See everything. Miss nothing.

Your implementations audited around the clock with real-time, real-user data. Real-time alerts about errors or changes in your data, campaigns, pixels, privacy and consent. Let AI flag issues before they cost you.