Ad Tag

An ad tag is a code snippet that directs browsers on where and how to display ads on websites or apps.
Glossary mascot
Glossary mascot

On this page

What is the ad tag?

An ad tag is a small piece of code, typically written in HTML or JavaScript, that acts as a placeholder for advertisements on a website or application. Essentially, it’s a code snippet that instructs the browser where and how to display an ad.

How to read an ad tag?

An ad tag typically includes:

  • Ad server URL: The address of the ad server.
  • Ad size: The width and height of the ad.
  • Ad format: For example, banner, video, or native ad.
  • Other parameters: Ad placement ID, user information, etc.

Example

<script async src=”//tag.ads.com/ad?size=300×250&slotname=banner_top”></script>

In this example, the ad tag sends a request to the ad server at //https://support.google.com/google-ads/answer/2476688?hl=en to retrieve a 300×250 pixel ad and display it in the “banner_top” position.

How does it work?

how ad tag works
  1. Placement: The website publisher places the ad tag in the desired location on their website.
  2. Request: When a user visits the page, the ad tag sends a request to the ad server.
  3. Ad delivery: The ad server receives the request, analyzes relevant information (like location, device, user), and selects the most suitable ad. It then sends the ad back to the browser.
  4. Display: The browser receives the ad from the ad server and displays it in the designated location specified by the ad tag.

This process happens in milliseconds so users see ads seamlessly as the page loads.

Why are ad tags necessary?

Ad tags perform 4 main functions:

  • Ad display: This is the primary function of an ad tag.
  • Performance tracking: Ad tags enable tracking of ad performance metrics like impressions, clicks, and conversions, allowing for effective campaign evaluation.
  • Customization: Ad tags facilitate the customization of ad parameters such as size, format, and target audience.
  • Platform integration: Ad tags can connect with various advertising platforms, enabling publishers to diversify their revenue streams.

What are the types of ad tags?

There are 3 common most common types which are synchronous, asynchronous, and third-party ad tags.

SynchronousAsynchronousThird-party
DescriptionThese tags load ads at the same time as the rest of the webpage content.Asynchronous tags load ads independently of the main webpage content, preventing delays in page rendering.These tags are provided by external ad networks or agencies and allow ads to be served from external servers.
ProsSimple to implement.Faster page load times and better user experience.Enables broader ad inventory access and advanced targeting.
ConsCan slow down page load speeds if the ad server responds slowly.Slightly more complex to implement than synchronous tags.Can lead to inconsistencies if the third-party server fails or lags.

Best practices for using ad tags

Here are some practices you should follow to keep your ad tags run efficiently:

  • Optimize your ad tags to avoid slowing down page load speeds. Compress creatives and limit excessive tag chaining.
  • Placing multiple ad tags for the same space can cause overlapping ads or tracking errors. Regularly audit placements to avoid redundancy.
  • Keep ad tags up-to-date to comply with the latest ad server or network protocols, improving compatibility and performance.
Related terms

Cohort Analysis

Cohort analysis is essential for tracking and understanding customer behavior trends, and identifying valuable customer groups to focus on for ...

View detail

Cookie

A cookie, in the context of the internet, is a small text file that a website stores on your device (computer, smartphone, or tablet) when you visit it. ...

View detail

Marketing Automation

Marketing automation uses software to automate tasks, streamline workflows, and personalize ...

View detail