How to make styled 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 styled native ad template. This type of native template has only the HTML code. You must add the necessary JavaScript code and style element directly to your website to display the ad properly.

If you'd rather have all the necessary code (HTML, JavaScript and CSS) in the template, you should make your slideshow ad using a custom 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 styled slideshow ad. You can customize the sample code to fit your needs.
  2. How to create a styled slideshow ad item once you have a styled slideshow template.

How to create a styled 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 Templates in the left navigation menu. The Templates section will appear.
  2. Click Native Ad Templates. The Native Ad Templates subsection will appear.
  3. Click Add Native Ad Template. The New Native Template window will appear.
  4. Click Styled. 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 (Raw) variables. 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 styled 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 (Styled) field, then click Save Changes.

Here's the code we used in our example:

<div class="slideshow-container">
    <div class="slides-container">
        <div class="slide">
            <div class="slide-label">
                Advertisement 1
            <a href="[TRACKING_LINK][%DestinationURL%]" target="_blank">
                <img src="[%ImageURL%]">
        <div class="slide">
            <div class="slide-label">
                Advertisement 2
            <a href="[TRACKING_LINK][%DestinationURL2%]" target="_blank">
                <img src="[%ImageURL2%]">
        <div class="slide">
            <div class="slide-label">
                Advertisement 3
            <a href="[TRACKING_LINK][%DestinationURL3%]" target="_blank">
                <img src="[%ImageURL3%]">
        <a class="prev">
        <a class="next">
        <div class="slideshow-close-button-container">
            <span class="slideshow-close-button">×</span>
    <div class="dot-container">
        <div class="dot"></div>
        <div class="dot"></div>
        <div class="dot"></div>

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

Back to top

How to create a styled 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).
Styled native ad items can be assigned only to Native zones, with or without custom rendering enabled.
  1. Click Add Ad Item in the Ad Items table. The Add Ad Item window will appear.
  2. Click Native (Styled). The New Ad Item page will appear.

Creating a native (styled) ad item

  1. Select your slideshow styled 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 styled native ad item in AdButler

At this point, you have finished setting up the ad item on the AdButler interface. You must now add the JavaScript and style element needed to display this ad properly directly to your website. Here's the sample code that we used in our example. You must replace the zone tags and zone class in the code with your own zone tags and zone class.

<!DOCTYPE html>
<html lang="en">
            .slideshow-container {
                max-width: 1000px;
                position: relative;
                margin: auto;

            .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;
        <!-- To Edit 1: Replace Zone Tags below here with your own --><script type="text/javascript">if (!window.AdButler){(function(){var s = document.createElement("script"); s.async = true; s.type = "text/javascript"; s.src = ''; var n = document.getElementsByTagName("script")[0]; n.parentNode.insertBefore(s, n);}());}</script>
        <div class="plc104325"></div>
        <script type="text/javascript">
            var AdButler = AdButler || {}; = || [];
            var abkw = window.abkw || '';
            var plc104325 = window.plc104325 || 0;
                var divs = document.querySelectorAll(".plc104325:not([id])");
                var div = divs[divs.length-1];
       = "placement_104325_"+plc104325;
      {handler: function(opt){ AdButler.register(######, ######, [0,0], 'placement_104325_', opt); }, opt: { place: plc104325++, keywords: abkw, domain: '', click: 'CLICK_MACRO_PLACEHOLDER' }});
        <!-- Replace Zone Tags above here with your own -->

            var slides, dots;
            var currentSlideIndex = 0;

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

                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";

   () {
                // To Edit 2: Update this class with your zone's class
                var zoneClass = 'plc104325';
                var wrapper = document.querySelector('.' + zoneClass);
                wrapper.addEventListener(AdButler.EVENTS.LOAD, function (e) {
                    slides = document.querySelectorAll('.' + zoneClass + ' .slide');
                    dots = document.querySelectorAll('.' + zoneClass + ' .dot');

                    <!-- Below code makes the close button functional -->
                    var closeButton = document.querySelector('.' + zoneClass + ' .slideshow-close-button');
                    closeButton.addEventListener('click', function () {
                        document.querySelector('.' + zoneClass + ' .slideshow-container').style.display = 'none';

                    <!-- Below code makes the prev button functional -->
                    var prevButton = document.querySelector('.' + zoneClass + ' .prev');
                    prevButton.addEventListener('click', function () {
                        showSlide(currentSlideIndex - 1);

                    <!-- Below code makes the next button functional -->
                    var nextButton = document.querySelector('.' + zoneClass + ' .next');
                    nextButton.addEventListener('click', function () {
                        showSlide(currentSlideIndex + 1);

                    <!-- Below code allows clicking on the dots below the slideshow to go to a specific slide -->
                    // if you cannot use ES6, use the below code
                    for (var i = 0; i < dots.length; i++) {
                        dots[i].addEventListener('click', (function(j) {
                            return function() { showSlide(j); };

                    // if you can use ES6, uncomment the below code and remove the above code block
                    // for (let i = 0; i < dots.length; i++) {
                    //     dots[i].addEventListener('click', () => showSlide(i));
                    // }

Back to top

Can't find what you're looking for?

Send us an email

Visit the blog

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