
scheduling ads via javascript
Hi Team,
I'm adding ad tags via javascript but this below scripting doesn't work, please can you look at it.
var adSchedule="{";
function pushAd(adTime,adTag){
ctrl=true;
if(adTime=="pre" || adTime=="post"){
adStr='roll'+adRollCount+':{offset:"'+adTime+'",tag:"'+adTag+'"},';
}else{
adStr='roll'+adRollCount+':{offset:'+adTime+',tag:"'+adTag+'"},';
}
adSchedule = adSchedule.concat(adStr);
adRollCount++;
}
function commitAds(){
adSchedule = adSchedule.concat("}");
adSchedule = adSchedule.replace("},}", "}}");
}
//Below I'm passing generated 'adSchedule' string to the schedule tag
advertising: {
client: adtype,
'skipoffset':5,
schedule: adSchedule
},