Search code examples
google-swiffy

Swiffy HTML5 creative clickTAG vs link1


When we are converting creative from swf to html5 with Swiffy and as result we got clickTAG or link1 GET options to redirect url.

Because of this, we have to transmit the same data in the two settings.

Question Can swiffy runtime replace all link1 to clickTAG so that we can pass a reference to the clickTAG!


Solution

  • I was found the solution

    var stage = new swiffy.Stage(document.getElementById('swiffycontainer'),
    swiffyobject, {});
    
    var tmpVars = {}, flashVars = [];
    var keyValues = window.location.search.substring(1).split('&');
    for (var i in keyValues) {
        var key = keyValues[i].split('=');
        if (key.length > 1) {
            tmpVars[key[0]] = key[1];
        }
    }
    if (tmpVars.hasOwnProperty('clickTAG')) {
        tmpVars.link1 = tmpVars.clickTAG;
    }
    for (var i in tmpVars) {
        flashVars.push([i, tmpVars[i]].join('='));
    }
    
    stage.setFlashVars(flashVars.join('&'));
    stage.start();