Ad Tags

By  Joachim Schmidt
Last updated September 21, 2026

An ad tag is the small piece of code that connects an ad slot on your website with an advertising platform. You place it on a page, and the tag tells the ad server or ad network where to show an ad and what information belongs to that ad request.

If you have ever copied a few lines of JavaScript from Google Ad Manager, AdSense, Media.net, or another advertising platform into your WordPress site, you have probably already worked with an ad tag. They may look like ordinary HTML or JavaScript, but they are doing quite a bit of work behind the scenes.

For publishers, understanding ad tags matters because they often bridge your website and the platform that delivers your ads.

What is an ad tag in digital advertising?

An ad tag connects three things: your website, a specific ad slot, and the advertising platform that supplies the creative.

A typical process looks like this. Your webpage loads an ad tag. The tag identifies the ad unit or passes information such as its size and targeting parameters. The advertising platform receives the request, decides which ad to serve, and sends the necessary creative or rendering instructions back to the browser.

With Google Ad Manager, for example, Google Publisher Tags define inventory, initiate ad requests, and render the matching demand. Google describes GPT as an ad tagging library that takes information such as the ad unit code, ad size, and key-value pairs and uses it to build the ad request.

This means an ad tag is not the advertisement itself. It is the technical instruction that tells the advertising system how to request and display one.

What does an ad tag look like?

There is no single format for an ad tag. Different advertising platforms provide different snippets, and the code can range from a few lines to a larger JavaScript implementation.

A simplified example might look like this:

<div id="ad-slot-12345">

  <script>

    requestAd({

      adUnit: "homepage-top",

      size: [728, 90]

    });

  </script>

</div>

This is only an illustrative example, not a tag you can use with a real ad network. The key parts are the ad unit identifier and the ad slot information.

A real Google Ad Manager setup is more elaborate because GPT separates the library loaded on the page from the individual ad slots. A page might load Google's GPT library and then define a slot such as a 728 × 90 or 300 × 250 unit. The generated tag contains the information required to request that inventory from Ad Manager. Google provides a tag generator in Ad Manager, so publishers don't have to build the code manually.

AdSense uses a slightly different implementation. Its ad code is also an HTML snippet with attributes that identify the publisher and, where applicable, the ad unit. Google describes AdSense ad code as HTML placed on an approved website to allow ads to be shown in a specific layout.

A simplified version can look like this:

<ins class="adsbygoogle"

     style="display:block"

     data-ad-client="ca-pub-XXXXXXXX"

     data-ad-slot="1234567890">

</ins>

<script>

  (adsbygoogle = window.adsbygoogle || []).push({});

</script>

Which platforms use ad tags for ad serving?

Ad tags are common across the ad tech ecosystem. They are especially common for publishers using ad servers, ad exchanges, and advertising networks that require code on the publisher’s website.

Google Ad Manager is a clear example. Publishers generate Google Publisher Tags for their ad units and insert them into their webpages. Ad Manager uses these tags to request and deliver ads for the corresponding inventory. Google Ad Exchange also provides ad tags. These Ad Exchange ad tags contain the information required for an ad request and can be generated for different inventory types.

Google AdSense uses its own ad code for displaying ads. Although Google generally calls this “ad code” rather than GPT, it serves the same basic purpose from a publisher’s perspective: code placed on the website connects the page with Google’s advertising system. Media.net is another example. The platform explicitly provides publishers with ad tags.

The terminology differs between platforms. One provider may call its implementation an ad tag; another may call it ad code, publisher tag, placement code, or a JavaScript tag. From a publisher’s perspective, the basic concept is similar: you receive code from the advertising platform and place that code where the corresponding advertising inventory should appear.

How to implement third-party ad tags in WordPress?

This is where things can get messy. A publisher might receive one piece of code that belongs in the <head> section and another that belongs at the actual position of the ad slot in the page body. With Google Ad Manager, for example, GPT can involve both the library and individual ad slots. Other platforms may provide one self-contained snippet.

You can paste this code directly into theme files, custom HTML blocks, widgets, or code-injection tools. That works, but it becomes difficult to manage when you have multiple ad networks, placements, devices, or dozens of ad slots. In that case, a dedicated ad management plugin like AdPresso makes life easier.

Managing ad tags with AdPresso

With AdPresso, you can keep ad tags inside your WordPress ad setup instead of scattering snippets across theme files and individual posts. The plugin provides dedicated placements for different integration types. A Header Code placement is designed for scripts and code that need to be inserted before the closing <head> tag. 

A Footer Code placement can be used for scripts that should load before the closing <body> tag. For visible advertising, you can use regular placements such as Before Content, After Content, Content, or Manual Placement, depending on where the ad should appear.

For example, instead of adding an ad network’s code manually to several templates, you can create the relevant ad or code configuration in AdPresso and assign it to a placement. The placement then determines where the code belongs, while the ad setup remains centrally manageable in the WordPress backend.

Joachim Schmidt

About the Author

Joachim Schmidt has over 15 years of experience in digital monetization. He launched his first news site in 2005 and later mastered affiliate marketing through his own successful travel blogs. Before joining AdPresso, Joachim spent years building up Advanced Ads. As a core driving force behind the ad management plugin until 2025, he authored countless technical tutorials and personally resolved thousands of user support tickets.

This is AdPresso

Streamlined WordPress ad management, built on 15 years of expertise for serious monetization.
Features robust protection, targeting, A/B testing, diverse placements, and insightful tracking to spark your full revenue potential.

BlogStudies
AdPresso Logo