Skip to main content

Using Global Click Action for Lightbox second state

You can already define all the links for your Lightbox second state in the HTML5 file, but it is possible to add a global click action in Campaign Manager as well.

If you want to add a global click action for your Lightbox ad, then you need to modify your HTML5 file accordingly by inserting this code snippet:

window.addEventListener("message", function(e) { 
if (e.data.clickTag) {
window.clickTag = e.data.clickTag;
}
});

Why this is needed:

The second state is shown through iframe and the source is our domain, but since the ad domain is where the ad is being shown, there will be a security error called β€œCORS”, which prevents stealing information through iframes. Information can still be shared by using message events between frames.

Did this answer your question?