How to make expanding ads (two creatives)

Expanding ads are ads that increase in size to reveal the whole image or another image when the viewer clicks or hovers their mouse cursor over the ad. You can use native templates to create expanding ad items that are tailored to your needs.

A sample expanding ad with two creatives

A sample expanding ad with two creatives fully revealed

In this guide, we're going to create a simple expanding ad with two creatives. You can customize the sample HTML code to fit your needs. If you want to make an expanding ad that has only one creative, read How to make expanding ads (one creative).

How to create a native expanding ad template (two creatives)

This template will require the user to provide the URLs to where the image creatives are hosted when creating the expanding ad item.

  1. Click Templates in the left navigation menu to go to the Templates section.
  2. Click Add New in the Native Ad Templates table. The New Native Template window will appear.
  3. Select the type of native template that you want to create. The New Native Ad Template page will appear.
Templates for native (custom rendering/API) ad items are not compatible with native (styled) ad items, and vice-versa.
  1. Name the template then add two image URL variables for the images that will be in the ad. In our sample code, we called these variables ImageURL and ImageURL2.
  2. Enter the code in the HTML/Script field, then click Save template.

Creating an expanding ad native template (two creatives)

Here's the code we used in our example:

<!DOCTYPE html>
<html lang="en">
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>
<body>
<style>
    #expand-container {
        position: relative;
        width: 600px;
        height: 350px;
        margin: 0 auto;
        box-sizing: content-box;
    }

    #image-container-1, image-container-2 {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 100;
    }

</style>
<script>
    function showImage2() {
        $('#image-container-1').css("visibility", "hidden");
        $('#image-container-2').css("visibility", "visible");
    }

    function showImage1() {
        $('#image-container-2').css("visibility", "hidden");
        $('#image-container-1').css("visibility", "visible");
    }
</script>
<div id="expand-container" onmouseover="showImage2()" onmouseout="showImage1()">
    <div id="image-container-1" >
        <a target="_blank" href="[TRACKING_LINK]">
            <img src="[%ImageURL%]">
        </a>
    </div>
    <div id="image-container-2" style="visibility: hidden;">
        <a target="_blank" href="[TRACKING_LINK]">
            <img src="[%ImageURL2%]">
        </a>
    </div>
</div>
</body>
</html>

How to create a native expanding ad item (two creatives)

  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).
We recommend assigning native ad items and campaigns with native ad items to dynamic zones.
  1. Click Add New in the Ad Items table. The Add Ad Item window will appear.
  2. Click Native. The New Ad Item page will appear.
  3. Select your expanding native ad template in the Template dropdown menu.
  4. Fill in the rest of the fields as needed, including the image URLs. If you entered a destination URL, you can test it by clicking Open Destination URL to the right of the field.
  5. Click Save Ad Item.
Read About ad items for more on AdButler's ad item types and their parameters.

Creating a native expanding ad item (two creatives)


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.