How to make custom native sponsored ads
Sponsored ads are similar to in-feed ads, but they're usually placed on a retail page. They still blend in with the content somewhat but they look more like recommendations instead of an actual product or service listing. You can use native templates to create sponsored ad items that are tailored to your needs.
If you'd rather sanitize the template and have only HTML inside it, you should make your sponsored ad using a styled native ad template instead. For more information on the differences between custom native ads and styled native ads, read About native ad templates.
You will learn:
- How to create a template for a custom sponsored ad. You can customize the sample code to fit your needs.
- How to create a custom sponsored ad item once you have a custom sponsored template.
How to create a custom sponsored ad template
This template will require the user to provide the URL to where the image creative is hosted when creating the sponsored ad item, as well as the URL to the page where the viewer will be taken when they click on the ad. There are also text fields for the header and the body text that need to be filled.
- Click Native Ad Templates in the left navigation menu to go to the Templates section.
- Click Add Native Ad Template in the Native Ad Templates table. The New Native Template window will appear.
- Click Custom Rendering/API. The New Native Ad Template page will appear.
- Name the template, then add a URL variable for the destination URL, an image URL variable for the creative, and two text variables (one for the header and one for the body text). In our sample code, we called these variables Sponsored Link, ImageURL, Header, and Description, respectively.
- Enter the code in the HTML Template (Custom Rendering) field, then click Save Changes.
Here's the code we used in our example:
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.sponsored-container {
position: relative;
width: 425px;
height: 152px;
}
.sponsored-content-container {
--sponsored-content-height: 120px;
display: grid;
grid-template-columns: repeat(2, auto) 1fr;
grid-template-rows: var(--sponsored-content-height);
grid-gap: 24px;
font-family: Arial;
text-decoration: none;
padding: 16px;
}
.sponsored-image {
height: var(--sponsored-content-height);
width: var(--sponsored-content-height);
border-radius: 10px;
}
.sponsored-text-container {
color: #000000;
display: grid;
grid-template-rows: 1fr repeat(3, auto) 1fr;
row-gap: 4px;
font-size: 14px;
}
.sponsored-header {
grid-row: 2/3;
font-size: 16px;
font-weight: bold;
margin-bottom: 4px;
}
.sponsored-description {
grid-row: 3/4;
}
.sponsored-link {
grid-row: 4/5;
}
p {
margin: 0;
}
.sponsored-close-button-container {
position: absolute;
top: 16px; /* match container top padding */
right: 5px;
cursor: pointer;
}
.sponsored-close-button {
width: 21px;
text-align: center;
display: inline-block;
color: #ffffff;
font-size: 18px;
background: #000000;
border-radius: 21px;
user-select: none;
}
</style>
</head>
<body>
<div class="sponsored-container">
<a href="[TRACKING_LINK]" target="_blank" class="sponsored-content-container">
<img src="[%ImageURL%]" class="sponsored-image">
<div class="sponsored-text-container">
<p class="sponsored-header">[%Header%]</p>
<p class="sponsored-description">[%Description%]</p>
<p class="sponsored-link">[%Sponsored Link%]</p>
</div>
</a>
<div class="sponsored-close-button-container">
<span class="sponsored-close-button" onclick="closeButton()">×</span>
</div>
</div>
<script>
function closeButton() {
document.querySelector('.sponsored-container').style.display = 'none';
}
</script>
</body>
</html>
You can now use this template to create a custom sponsored ad ad item.
How to create a custom sponsored ad ad item
- Go to the section of the relevant zone (Your AdButler > Publishers > Your Publisher > Your Zone) or campaign (Your AdButler > Advertisers > Your Advertiser > Your Campaign).
- Click Add Ad Item in the Ad Items table. The Add Ad Item window will appear.
- Click Native (Custom Rendering/API). The New Ad Item page will appear.
- Set the ad item's size.
If the ad item or its campaign will be assigned to a Standard zone, you must set the ad item's size to Dynamic.
If the ad item or its campaign will be assigned to a Native zone, you must enter the ad item's exact size. You can do this either by selecting Preset Size and then selecting the matching width and height values from the dropdown menu, or selecting Custom Size then entering the values in the fields that appear.
- Select your sponsored ad custom native template in the Template dropdown menu.
- Fill in the rest of the fields as needed, including the URL, image URL, and text fields. If you entered a destination URL, you can test it by clicking Open Destination URL to the right of the field.
- Click Save Ad Item.