How to make custom native slideshow ads

A slideshow ad combines multiple videos, images, or a combination of both that viewers can scroll through. It's often used to showcase several products at once, or to list a product's features. You can use native templates to create slideshow ad items that are tailored to your needs.

A sample slideshow ad

This feature requires the Enhanced Ads add-on. For more information on adding add-ons to your subscription, read How to change your subscription.

In this guide, we're going to create a simple slideshow ad using a custom native ad template. This type of native template has all the code - HTML, JavaScript, and style element - necessary to display the ad properly.

If you'd rather sanitize the template and have only HTML inside it, you should make your slideshow 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.

Templates for custom native ad items are not compatible with styled native ad items, and vice-versa.

You will learn:

  1. How to create a template for a custom slideshow ad. You can customize the sample code to fit your needs.
  2. How to create a custom slideshow ad item once you have a custom slideshow template.

How to create a custom slideshow ad template

This template will require the user to provide the URLs to where the image creatives are hosted as well as the destination URLs for each image when creating the slideshow ad item.

  1. Click Native Ad Templates in the left navigation menu to go to the Templates section.
  2. Click Add Native Ad Template in the Native Ad Templates table. The New Native Template window will appear.
  3. Click Custom Rendering/API. The New Native Ad Template page will appear.

Selecting a native template type

  1. Name the template then add the variables as needed. In our sample code, we used three Image URL variables and three URL variables (you can use either raw or encoded). We called the image URL variables ImageURL, ImageURL2, and ImageURL3, and the URL variables DestinationURL, DestinationURL2, and DestinationURL3.
For templates that have multiple variables such as this one, you can drag the icon on the far left of each variable field up or down to reorder your variables.

Creating a custom native slideshow ad template

You can save variables and use them in other templates. After adding a variable, click on the three dots at the far right of the variable fields then click Save Variable as Template. To use a saved variable, click Add Saved Variable while creating a native template.
  1. 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>
            .slideshow-container {
                max-width: 1000px;
                position: relative;
                margin: auto;
            }

            .slides-container {
                position: relative;
            }

            .slide-label {
                color: #f2f2f2;
                font-size: 12px;
                padding: 8px 12px;
                position: absolute;
                top: 0;
            }

            .slide {
                display: none;
                animation-name: fade;
                animation-duration: 1.5s;
            }

            @keyframes fade {
                from {opacity: .4}
                to {opacity: 1}
            }

            .slide:first-of-type {
                display: block;
            }

            .slide img {
                width: 100%;
            }

            .dot-container {
                width: fit-content;
                margin: 1rem auto;
            }

            .dot {
                cursor: pointer;
                height: 15px;
                width: 15px;
                margin: 0 2px;
                background-color: #bbb;
                border-radius: 50%;
                display: inline-block;
                transition: background-color 0.6s ease;
            }

            .dot:first-of-type {
                background-color: #717171;
            }

            .prev, .next {
                cursor: pointer;
                position: absolute;
                top: 50%;
                width: auto;
                padding: 16px;
                margin-top: -22px;
                color: white;
                font-weight: bold;
                font-size: 18px;
                transition: 0.6s ease;
                border-radius: 0 3px 3px 0;
                user-select: none;
            }

            .next {
                right: 0;
                border-radius: 3px 0 0 3px;
            }

            .prev:hover, .next:hover {
                background-color: rgba(0,0,0,0.8);
            }

            .slideshow-close-button-container {
                position: absolute;
                top: 15px;
                right: 15px;
                cursor: pointer;
            }

            .slideshow-close-button {
                width: 26px;
                text-align: center;
                display: inline-block;
                color: #ffffff;
                font-size: 22px;
                background: #000000;
                border-radius: 26px;
                user-select: none;
            }
        </style>
    </head>
    <body>
        <div class="slideshow-container">
            <div class="slides-container">
                <div class="slide">
                    <div class="slide-label">
                        Advertisement 1
                    </div>
                    <a href="[TRACKING_LINK][%DestinationURL%]" target="_blank">
                        <img src="[%ImageURL%]">
                    </a>
                </div>
                <div class="slide">
                    <div class="slide-label">
                        Advertisement 2
                    </div>
                    <a href="[TRACKING_LINK][%DestinationURL2%]" target="_blank">
                        <img src="[%ImageURL2%]">
                    </a>
                </div>
                <div class="slide">
                    <div class="slide-label">
                        Advertisement 3
                    </div>
                    <a href="[TRACKING_LINK][%DestinationURL3%]" target="_blank">
                        <img src="[%ImageURL3%]">
                    </a>
                </div>
                <a class="prev" onclick="changeSlide(-1)">
                    <
                </a>
                <a class="next" onclick="changeSlide(1)">
                    >
                </a>
                <div class="slideshow-close-button-container">
                    <span class="slideshow-close-button" onclick="closeButton()">×</span>
                </div>
            </div>
            <div class="dot-container">
                <div class="dot" onclick="showSlide(0)"></div>
                <div class="dot" onclick="showSlide(1)"></div>
                <div class="dot" onclick="showSlide(2)"></div>
            </div>
        </div>
        <script>
            var slides, dots;
            var currentSlideIndex = 0;

            function showSlide(slideIndex) {
                var prevSlideIndex = currentSlideIndex;
                currentSlideIndex = slideIndex;

                if (!slides || ! dots) {
                    slides = document.querySelectorAll(".slide");
                    dots = document.querySelectorAll( ".dot");
                }

                if (currentSlideIndex > slides.length - 1) {
                    currentSlideIndex = 0
                }

                if (currentSlideIndex < 0) {
                    currentSlideIndex = slides.length - 1;
                }

                slides[prevSlideIndex].style.display = "none";
                dots[prevSlideIndex].style.backgroundColor = "#bbb";

                slides[currentSlideIndex].style.display = "block";
                dots[currentSlideIndex].style.backgroundColor = "#717171";
            }

            function changeSlide(addToIndex) {
                showSlide(currentSlideIndex + addToIndex);
            }

            function closeButton() {
                document.querySelector('.slideshow-container').style.display = 'none';
            }
        </script>
    </body>
</html>

You can now use this template to create a custom slideshow ad item.

Back to top

How to create a custom slideshow ad item

  1. Go to the section of the relevant zone (Your AdButler > Publishers > Your Publisher > Your Zone) or campaign (Your AdButler > Advertisers > Your Advertiser > Your Campaign).
Custom native ad items can be assigned only to Standard zones or to Native zones. For Standard zones, the zone size must be set to Dynamic. For Native zones, the Enable Custom Rendering option must be turned on. Both the zone size and the custom rendering option can be configured only when creating a zone and cannot be changed afterward.
  1. Click Add Ad Item in the Ad Items table. The Add Ad Item window will appear.
  2. Click Native (Custom Rendering/API). The New Ad Item page will appear.

Creating a native (custom rendering/API) ad item

  1. 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.

  1. Select your slideshow custom native ad template in the Template dropdown menu.
  2. Fill in the rest of the fields as needed, including the image URLs and destination URLs.
  3. Click Save Ad Item.

Creating a slideshow ad custom native ad item in AdButler

Back to top


Can't find what you're looking for?

Send us an email

hello@adbutler.com

Visit the blog

For more ad serving tips, industry news and AdButler insights.