Jump to content

[Tips] clickurl inside iframe

Recommended Posts


Here is some javascript to easy have click count  with swiffy ads inside an iframe.

In Revive adserver : create HTML Generic Banner, replace [URL_OF_YOUR_HTML_SWIFFY_FILE] with the url of your swiffy html file.

We give clickurl with magicmacro


<iframe src="[URL_OF_YOUR_HTML_SWIFFY_FILE]?clickurl={clickurl}" width="100%" height="90px" frambedorder="0"></iframe>


Edit your swiffy html file, go down and replace last <script> block 

var stage = new swiffy.Stage(document.getElementById('swiffycontainer'), swiffyobject, {});


    // !!!!!!! Ads destination link !!!!!!
    var lienClient = '';

    var clickurl = /clickurl=([^&]+)/.exec(document.location.href)[1];

    var swiffycontainer = document.getElementById('swiffycontainer');

    if (clickurl) {
        var parent  = swiffycontainer.parentNode;
        var wrapper = document.createElement('a');
        wrapper.setAttribute("href", clickurl + lienClient);
        wrapper.setAttribute("target", "_blank");
        // set the wrapper as child (instead of the element)
        parent.replaceChild(wrapper, swiffycontainer);
        // set element as child of wrapper

    var stage = new swiffy.Stage(swiffycontainer, swiffyobject, {});


Thanks to http://forum.revive-adserver.com/topic/3194-generic-html5-banner-clicks-tracking/  and http://stackoverflow.com/questions/6938248/insert-a-div-element-as-parent


Edited by yannux
Code cleaning

Share this post

Link to post
Share on other sites

clicks count not working  with  iframe like 

<iframe src="[URL_OF_YOUR_HTML_SWIFFY_FILE]?clickurl={clickurl}" width="100%" height="90px" frambedorder="0"></iframe>
Edited by pankaj

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...