How to make custom native in-feed ads
In-feed ads are ads that appear to look like one of the items listed on a page, AKA a feed. You can make it look like the teaser to a blog post or a description of a product or service. This way, you can make it blend in with the rest of the content. You can use native templates to create in-feed 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 in-feed 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 in-feed ad. You can customize the sample code to fit your needs.
- How to create a custom in-feed ad item once you have a custom in-feed template.
How to create a custom in-feed ad template
This template will require the user to provide the URL to where the image creative is hosted when creating the in-feed ad item. 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 an image URL variable and two text variables (one for the header and one for the body text). In our sample code, we called these variables ImageURL, Main Heading, and Body, 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>
.in-feed-container {
position: relative;
float: left;
width: 604px;
border: 1px solid #ececec;
padding: 12px;
}
.in-feed-image-container {
width: 220px;
height: 180px;
float: left;
}
.in-feed-image {
height: 100%;
width: 100%;
object-fit: cover;
}
.in-feed-content-container {
width: 360px;
height: 141px;
float: left;
margin-left: 20px;
}
.in-feed-content-header, .in-feed-content-link {
color: #383838;
text-decoration: none;
margin-top: 0;
margin-bottom: 10px;
line-height: 1.4em;
}
.in-feed-close-button-container {
position: absolute;
top: 2px;
right: 2px;
cursor: pointer;
}
.in-feed-close-button {
width: 18px;
display: inline-block;
text-align: center;
color: #ffffff;
border-radius: 18px;
background: #000000;
user-select: none;
}
</style>
</head>
<body>
<div class="in-feed-container">
<div class="in-feed-image-container">
<a href="[TRACKING_LINK]">
<img class="in-feed-image" src="[%ImageURL%]">
</a>
</div>
<div class="in-feed-content-container">
<a href="[TRACKING_LINK]" class="in-feed-content-link">
<h2 class="in-feed-content-header">
[%Main Heading%]
</h2>
</a>
<p class="in-feed-content-body">
[%Body%]
</p>
</div>
<div class="in-feed-close-button-container">
<span class="in-feed-close-button" onclick="closeButton()">×</span>
</div>
</div>
<script>
function closeButton() {
document.querySelector('.in-feed-container').style.display='none';
}
</script>
</body>
</html>
You can now use this template to create a custom in-feed ad item.
How to create a custom in-feed 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 in-feed custom native ad template in the Template dropdown menu.
- Fill in the rest of the fields as needed, including the 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.