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.