The ad tag functions as an ad code and an ad snippet that serves as programming code mostly written in HTML or JavaScript which websites or applications implement into their source code to display advertisements.
They facilitate proper messaging between publishers who share content and advertisers who deliver advertisements alongside other ad serving platforms.
Function of an Ad Tag
Ad tags trigger an ad request from the publisher’s website or app to the ad server. This request specifies details about the ad unit, such as its size and location on the page.
The ad server then fetches an appropriate ad creative from an advertiser and delivers it back to the publisher’s website for display.
Benefits of Advertising Tags
-
Publishers:
Ad tags enable publishers to sell ad inventory to multiple advertisers and display relevant ads to their audience, maximizing their revenue from advertising.
-
Advertisers:
Ad tags allow advertisers to target specific audiences and placements on websites or apps, ensuring their ads reach the most relevant users.
-
Ad Networks:
Ad tags streamline the process of managing ad inventory and ad serving for ad networks.
Types of Advertising Tags
-
Synchronous Ad Tags:
These tags load at the same time as the rest of the webpage content. If the ad server is slow to respond or there’s an error in the code, it can slow down the page loading significantly.
-
Asynchronous Ad Tags:
These tags load independently of the webpage content. This ensures that even if there’s an issue with the ad tag, the webpage will still load normally, although the ad might not be displayed. Asynchronous ad tags are generally preferred due to their faster loading times.
-
Third-Party Ad Tags:
These tags are generated by ad networks or advertiser ad servers and are used to track ad impressions, clicks, and user engagement. They can also be used to deliver targeted advertising.
-
Other Types:
There are various other ad tags specific to different ad formats, such as VAST tags for video ads, rich media ad tags for interactive ads, and retargeting ad tags for serving ads based on user behavior.
Components of Advertising Tags
An ad tag typically contains various pieces of information, including:
- URL: This specifies the ad server that will be contacted to fetch the ad creative.
- Ad Type: This indicates the format of the ad, such as image, video, or rich media.
- Publisher Details: This identifies the publisher and helps verify their legitimacy.
- Zone: This specifies the location on the webpage or app where the ad will be displayed.
- Targeting Criteria: This may include information about the content of the webpage, user demographics, or interests to help deliver relevant ads.
- Ad Size: This defines the dimensions of the ad unit.
- Cache Buster: This is a random number used to prevent the same ad from being served repeatedly to the same user.
How Ad Tags Work
When a user visits a webpage or opens an app with an ad tag, the code in the ad tag is triggered.
- The ad tag sends an ad request to the publisher’s ad server, specifying details about the ad unit and the user.
- The ad server may consult a data management platform (DMP) to gather user information for better ad targeting.
- The ad server then forwards the ad request to an advertiser’s ad server (for direct deals) or a demand-side platform (DSP) for real-time bidding.
- If real-time bidding is involved, an auction is held among advertisers to determine who will have their ad displayed.
- The winning advertiser’s ad server sends the ad creative back to the publisher’s ad server.
- The publisher’s ad server then delivers the ad creative to the webpage or app for display.
Example of Ad Tag
Here’s an example of an ad tag code snippet:
Ad Tag Example
Here’s an example of an ad tag code snippet:
<script async src="https://exampleadserver.com/adserve.js"> { "pubId": "12345", "adUnit": "rectangle_300x250", "targeting": { "interests": ["technology", "gadgets"], "location": "US", "age": "25-34" }, "customData": { "pageCategory": "blog", "articleId": "ABC123XYZ" }, "clickUrl": "https://trackier.com/click?campaign_id=789&aff_id=456&source_id={random}" } </script> <div id="ad-container-rectangle_300x250"></div>
Let’s break down this example ad tag and explain each component:
-
<script async src=”https://exampleadserver.com/adserve.js”></script>
This is the core of the ad tag. This is where the HTML code begins its function in this context.
-
<script>
This HTML code tag indicates that the enclosed content is a script, in this case, JavaScript.
-
async
This attribute tells the browser to load the script asynchronously. This is crucial for performance, as it prevents the ad loading from blocking the rest of the webpage from rendering.
-
src=”https://exampleadserver.com/adserve.js
This specifies the URL of the ad server’s JavaScript library. This library contains the code that handles the ad request and display. This URL points to the ad server, a key component of the ad serving process.
-
{ … }
This block of code enclosed within the script tag is a JavaScript object containing configuration parameters for the ad request. These parameters provide important information to the ad server.
-
“pubId”: “12345”
This is the publisher ID. It uniquely identifies the website or app where the ad is being displayed. This information is critical for the ad server to know which publisher’s inventory is being used.
-
“adUnit”: “rectangle_300x250”
This specifies the ad unit or placement on the page. In this case, it’s a rectangle with dimensions 300×250 pixels. This tells the ad server what size creative tags to deliver. The corresponding <div id=”ad-container-rectangle_300x250″> tag acts as a placeholder for the ad content.
-
“targeting”: { … }
This object contains targeting criteria. These parameters help the ad server select ads that are relevant to the user viewing the page.
- “interests”: [“technology”, “gadgets”] – This targets users who have shown interest in technology and gadgets.
- “location”: “US” – This targets users located in the United States.
- “age”: “25-34” – This targets users within the age range of 25 to 34.
-
“customData”: { … }
This object is for custom data that the publisher wants to pass to the ad server. This can be used for more granular targeting or reporting. This is an example of how publishers can provide additional context to the ad server.
- “pageCategory”: “blog” – This indicates that the ad is being displayed on a blog page.
- “articleId”: “ABC123XYZ” – This provides a unique identifier for the specific article on the blog page.
-
“clickUrl”:
- “https://trackier.com/click?campaign_id=789&aff_id=456&source_id={random}” – This is a crucial part for tracking clicks, especially in affiliate marketing. This is a very important use case for advertising tags.
- https://trackier.com/click – This is the base URL of a click tracking platform (Trackier).
- campaign_id=789 – This identifies the specific advertising campaign.
- aff_id=456 – This identifies the affiliate or publisher.
- source_id={random} – This is a dynamic parameter that generates a unique identifier for each click. This is essential for accurate tracking and attribution. The {random} part is a placeholder that would be replaced with a randomly generated string when the ad is served.
-
<div id=”ad-container-rectangle_300x250″></div>
This div element acts as the container where the ad will be displayed. The id of this div should match the “adUnit” value in the script configuration, ensuring the ad is placed in the correct location on the page. The ad server’s JavaScript library uses this id to insert the creative tags into the page. This is a very important part of how ad tags work.
How an Ad Tag Code Snippet Works
When the webpage loads, the browser encounters the <script> tag.
Because of the async attribute, the browser downloads and executes the adserve.js script without blocking the rest of the page. The script then reads the configuration parameters (the JavaScript object) and makes a request to exampleadserver.com.
The ad server uses the provided information (publisher ID, ad unit, targeting, custom data) to select an appropriate ad.
The ad server then sends the ad creative (image, video, etc.) back to the browser, and the adserve.js script inserts the ad into the div with the matching id. This whole process is facilitated by the ad tag.
This is a simplified explanation of the HTML codes involved.
This example demonstrates how different components of an ad tag work together to request, deliver, and display ads while also providing valuable information for targeting and tracking.
The clickUrl with dynamic parameters highlights the importance of accurate click tracking, especially in performance-based marketing models like affiliate marketing.
Advertising tags are essential for this type of marketing.
Benefits of Using Asynchronous Ad Tag:
-
Faster page load times:
Since asynchronous ad tags load independently, they don’t block the loading of the rest of the webpage content. This improves the overall user experience.
-
Improved ad performance:
Faster loading times can lead to better ad view-ability and click-through rates.
-
Reduced bounce rates:
Users are less likely to leave a webpage if it loads quickly.
Affiliate Marketing and Ad Tag
In affiliate marketing, ad tags can be a valuable tool for promoting affiliate products.
Publishers can use ad tags to display ads for affiliate products on their websites or apps. When a user clicks on an ad and makes a purchase, the publisher earns a commission from the sale.
Ad tags can be particularly effective for affiliate marketing because they allow publishers to target their ads. Creative tags are a key part of this process, ensuring that the ads displayed are visually appealing and relevant to the target audience.
The use of advertising tags is a standard practice in the affiliate marketing industry.
A reliable ad server is important for successful affiliate marketing campaigns. Using correct HTML code will ensure that the ad tag functions correctly.
Advertising Tags and Trackier
Trackier is a performance marketing platform that helps businesses track, measure, and optimize their marketing campaigns. Trackier’s click tracking functionality, as shown in the example clickUrl, is essential for accurate attribution in performance marketing.
By appending unique identifiers to click URLs within ad tags, Trackier can precisely track which clicks led to conversions, enabling marketers to optimize their campaigns and maximize their return on investment.
This integration with ad tags makes Trackier a valuable tool for affiliate marketers and performance marketers who rely on accurate tracking and attribution.