IAB Polite Ad Export Script

Oh hmm, I didn't notice the one second timeout part of your code until you mentioned this.

Reading the spec, it definitely seems like this isn't a requirement if the initial content is below an unspecified size. While I understand that you and a lot of folks would probably just like to have this politeness built-in, it isn't clear to me that's the case for everyone (or a large majority). @mlgore : I'm curious in your case, would you want this for all ads?

I think I'd rank the most "ideal" cases like:

  1. having an ad builder system that keeps track of sizes all along the way and lets you specify what's needed for initial content vs. host initiated subload. This adds a lot of tool complexity though.
  2. Automatically using a timeout if the content is above a certain size
  3. Having an option to use this or not on a per-ad basis, possibly with some user default setting

(there could even be combinations of these)

For now though, maybe the best route forward is to make an "IAB Polite" export script, that basically works as you made it. Shall I take a stab at this?

Yes please.

Question for you @Bendora:

Is there a reason you change the tag for the main container div, vs. surround it in <a>...</a> tags?

We do this when we are handeling a sitebar that scales.
I think @Daniel received some from me last week. But not the Exports. I'll DM some to you.

What we do it wrap <a> around the hype main <div>. give the style setting to the <a> and remove them from the main.

Don't ask me why. I am just exploring by trail and error. Not with or as a developer logic.

Shame when we sleep you all are awake. :slight_smile:
It is bed time for you all. It is 11 pm. :innocent:

I am really not an expert in these things. Media Impact has these defaults:
200 kB initially, max. 2MB in second (polite load)

I think as long as you stay under 200 kB the polite load is not necessary. Since I've always stayed under 200 kB so far, I didn't have to worry about it.

Maybe an export script with and without polite load would be possible?

1 Like

He'll build in an option field.

With a sitebar or larger banners <200kb is harder to achieve.

Okay, I've made a stab at it. Please use these manual install instructions:

  1. Download the export script from:
    (you may need to hit option-return in the browser to get the file to download)

  2. Open the /Applications/Utilities/Terminal.app and enter in this command:

    open ~/Library/Application\ Scripts/com.tumult.Hype4

    This will open the Applications Scripts folder; alternatively you can get to this via Hype's Preferences > Exporting > Show Export Scripts Folder in Finder

  3. Move the IABPoliteAd.hype-export.py file into the com.tumult.Hype4 folder

  4. Back in the Terminal, enter this command:

    chmod 755 ~/Library/Application\ Scripts/com.tumult.Hype4/IABPoliteAd.hype-export.py

    This will give the export script permission to run.

It should be installed now. In Hype, you should be able to choose the File > Export as HTML5 > IABPoliteAd… menu item.

There's a few minor changes I made from the code you posted in the Clicktag problem in index.html thread:

  • It allows for case insensitivity in the clicktag URL parameter
  • It allows for a target URL parameter
  • It sets the clicktag/target in the DOMContentLoaded event, since that's basically the same as a script at the bottom.

I should also note this is a bit different than the AxelSpringer export script in that:

  • It doesn't inline the *_hype_generated_script.js document data/loader contents
  • It doesn't request the HYPE-NNN.x.min.js runtime file in a <script> tag in the head; instead it lets the loader grab this
  • It always delays 1 second before loading to be polite. I don't have this as configurable.

Let me know how this works, and if it is good and passes any validation you use on production ads, then I'll make an installer and put it on our export scripts page.

1 Like

MMR_AxelSpringerScript.zip (83,3 KB)
MMR_PoliteAdExportScript.zip (83,8 KB)

There is something funny about the new script. My animation doesn't work properly then. With the AxelSpringer script everything is ok.

Indeed it seems to reset itself in a loop.

Also in both Exports we have a dual export of the getUriParams function.
Bildschirmfoto 2022-09-23 um 17.55.48

Would you mind sending a zip of your .hype document?
It looks like the problem is from changing the hype main content <div> tag to an <a> tag, but I'm not sure why that would be a problem. I can probably figure it out quickly with the document.


I assume this is because the hype document has this code in the head html as well. With an export script that adds it in, it will no longer be necessary to manually add it.


MMR_test.zip (232,5 KB)

you are right, I forgot to remove the code in the head.html...but even by removing it nothing has changed.

1 Like

Thanks! With that document I was able to quickly track down that the <a> tag didn't quite work right with the flexible layout that you were using. (I'd also wonder if you need flexible layout on that ad?, but that's beside the point)

I added a fix to the latest commit; would you mind trying the latest version again?

Please use the same steps to download, copy, and chmod as above:

(just replace the existing IABPoliteAd.hype-export.py file with this newer one)

Thank you!

Thank you very much. That looks much better already. I'll have this tested again and give you feedback.

The reason I need a flexible layout in this case is Media Impact's specifications for a Mobile Medium Rectangle Ad:
Format: 300×250 px, Retina display 600×500 px.

With a flexible layout I can save myself from creating two different sizes.


A question:
Does the clicktag function in PoliteAdScript behave differently than in AxelSpringer Script? When I click on the ad in the AxelSpringerScript there is a


which is correct.

With the PoliteAdScript comes a


Is this how it should be?

I've seen this before when I have an ad blocker enabled. Can you make sure you don't have any on?

I do not have an adblocker installed (I use Chrome). When I try this in Safari and click, nothing happens.

If you don't have a clicktag or target specified in the URL, then the behavior would be different, as it is currently coded.

  • The AxelSpringer export script will default to undefined for both values
  • The IABPoliteAd export script will default to a clicktag of javascript:void(0) and target of _blank

I'm actually surprised by Chrome's behavior on the IABPoliteAd; I would have thought it would not do anything at all in this case, as this is how Safari behaves.

I'd say the AxelSpringer behavior is more wrong; it is trying to open a file called "undefined".

Regardless, my assumption is that a clicktag/target will pretty much always be supplied. If you want different behavior in these cases though, please let me know.

Thank you for the explanation. I will report.

1 Like

@jonathan @Bendora
Sorry for the delay, but now I have received feedback from my contact at MediaImpact.

He tested the banner I exported with your script and said that everything is wonderful. Polite works, clicktag works, and the flexible layout works as well.

Thank you Jonathan for the effort and time you put into this scripts and the AxelSpringer script. This makes my job immensely easier and hopefully everyone else who has to deal with MediaImpact (or Axel Springer).

Even though Hype is not primarily intended as a tool for creating advertising banners, together with the export scripts it is a very powerful and unique tool that I would not want to do without.

Thanks a lot!