This document sets forth the steps on how to integrate AudienceScience in a site with e-planning multiple Ajax V4 codes.
It is important to make the integration in a test HTML which, once approved by AudienceScience, will be able to be implememnted in the real site.

1) Keywords Creation

Create a “option list” type keyword with the following configuration:
Name: gwd
Parameter name: gwd
Type: option list
Options:
A value per each new space to be integrated must be created.
You can create such value like this: PQ_PlacementID_LineItem (AudienceScience will provide the PlacementID and LineItem values for each case)
For example, given 3 spaces will be integrated (300x250, 728x90 and 160x600), then 3 options in the keyword gwd must be created:

PQ_PlacementID_LineItem


PQ_6R7eVt_ABCD-li1234
PQ_DZ3pq_ABCD-li1235
PQ_rQ4tq_ABCD-li1236

 

2) Campaign creation

Create a campaign with your desired configuration.
Important: The campaign must be segmented with the keyword 'gwd' and all its values as 'positive segmentation':

3) Tags - ads Load

Copy this tag and replace the text in orange by one of the placements. For example: the 728x90 placement is 6R7eVt

<script>

var win = window.top;

document.write('<scri'+'pt type='text/javascript' src='http://' + win.asiAdserver +'/rtbads/pq?mode=s&placement=' + 'PLACEMENT_1' + '&adgroup=' + win.asiPlacements['PLACEMENT_1'].default.key + '&blob=' + win.asiPlacements['PLACEMENT_1'].blob + '&cachebuster=$RANDOM&click=$ENC_LINKURL'></scri'+'pt>');

</script>

Example:

<script>

var win = window.top;

document.write('<scri'+'pt type='text/javascript' src='http://' + win.asiAdserver +'/rtbads/pq?mode=s&placement=' + '6R7eVt' + '&adgroup=' + win.asiPlacements['6R7eVt'].default.key + '&blob=' + win.asiPlacements['6R7eVt'].blob + '&cachebuster=$RANDOM&click=$ENC_LINKURL'></scri'+'pt>');

</script>

It is important to set the size of the ad and mark the option 'Fixed with dynamic load'


4) Codes

4A) Section Code
The section code in the page must be kept. However it is necessary to make the following changes:
-Position array: delete all placement calls that will be integrated to AudienceScience from the array
-Add functionality: two functionalities detailed in green must be added

<html> <body>

//Existing code:
<script language='JavaScript' type='text/javascript'><!-- var eplDoc = document; var eplLL = false; var eS1 = 'us.img.e-planning.net';var eplArgs = { iIF:1,sV:schemeLocal() + '://ads.e-planning.net/' ,vV:'4',sI:'1205d',sec:'FSN',eIs:['esp_seccion1','esp_seccion2'] }; function eplCheckStart() { if (document.epl) { var e = document.epl; if (e.eplReady()) { return true; } else { e.eplInit(eplArgs); if (eplArgs.custom) { for (var s in eplArgs.custom) { document.epl.setCustomAdShow(s, eplArgs.custom[s]); } } return e.eplReady(); } } else { if (eplLL) return false; if (!document.body) return false; var eS2; var dc = document.cookie; var cookieName = ('https' === schemeLocal() ? 'EPLSERVER_S' : 'EPLSERVER') + '='; var ci = dc.indexOf(cookieName); if (ci != -1) { ci += cookieName.length; var ce = dc.indexOf(';', ci); if (ce == -1) ce = dc.length; eS2 = dc.substring(ci, ce); } var eIF = document.createElement('IFRAME'); eIF.src = 'about:blank'; eIF.id = 'epl4iframe'; eIF.name = 'epl4iframe'; eIF.width=0; eIF.height=0; eIF.style.width='0px'; eIF.style.height='0px'; eIF.style.display='none'; document.body.appendChild(eIF); var eIFD = eIF.contentDocument ? eIF.contentDocument : eIF.document; eIFD.open();eIFD.write('<html><head><title>e-planning</title></head><bo'+'dy></bo'+'dy></html>');eIFD.close(); var s = eIFD.createElement('SCRIPT'); s.src = schemeLocal() + '://' + (eS2?eS2:eS1) +'/layers/epl-41.js'; eIFD.body.appendChild(s); if (!eS2) { var ss = eIFD.createElement('SCRIPT'); ss.src = schemeLocal() + '://ads.e-planning.net/egc/4/89bf'; eIFD.body.appendChild(ss); } eplLL = true; return false; } } eplCheckStart(); function eplSetAdM(eID,custF) { if (eplCheckStart()) { if (custF) { document.epl.setCustomAdShow(eID,eplArgs.custom[eID]); } document.epl.showSpace(eID); } else { var efu = 'eplSetAdM(''+eID+'', '+ (custF?'true':'false') +');'; setTimeout(efu, 250); } }
function eplAD4M(eID,custF) { document.write('
<div id='eplAdDiv'+eID+''></div>'); if (custF) { if (!eplArgs.custom) { eplArgs.custom = {}; } eplArgs.custom[eID] = custF; } eplSetAdM(eID, custF?true:false); } //Add this funtion function eplSetAd(eID) { if (eplCheckStart()) { var opts = (eplArgs.sOpts && eplArgs.sOpts[eID]) ? eplArgs.sOpts[eID] : {}; if (opts.custF) { document.epl.setCustomAdShow(eID,opts.custF); } document.epl.setSpace(eID, opts); } else { setTimeout('eplSetAd(''+eID+'');', 250); } }
//Add this funtion function eplAD4(eID, opts) { document.write('<div id='eplAdDiv'+eID+''></div>'); if (!opts) opts = {t:1}; if (!eplArgs.sOpts) { eplArgs.sOpts = {}; } eplArgs.sOpts[eID] = opts; eplSetAd(eID); } function schemeLocal() { if (document.location.protocol) { protocol = document.location.protocol; } else { protocol = window.top.location.protocol; } if (protocol) { if (protocol.indexOf('https') !== -1) { return 'https'; } else { return 'http'; } } } //--></script>  

4B) Placement Calls
//Include the named placements in the array, and delete the placement calls integrated to AudienceScience

<script type='text/javascript'>eplAD4M('esp_seccion1');</script>

<script type='text/javascript'>eplAD4M('esp_seccion2');</script>


4C) Prequal Code
Add the following code and replace the account name, date, and the corresponding placements.

 <script type='text/javascript' language='JavaScript'> 
   var cb = new Date().getTime();
   var asiPqTag = false;
   try {
    document.write('<sc' + 'ript type='text/javascript' language='JavaScript' src='http://pq-direct.revsci.net/pql?placementIdList=DPxZet,YppQzB,6D9eVr&cb=' + cb + ''></sc' + 'ript>');
   } catch(err) { }
</script>

<script>
var asiVars=[''];
if (typeof asiPlacements !== 'undefined') {
    for (var p in asiPlacements) {
        asiVars[p]='';
        asiVars.push(p);
        console.log('p: ' + p);
        for (var key in asiPlacements[p].data) {
            asiVars[p] += 'PQ_' + p + '_' + key;
            console.log('asiVars[' + p + '] = ' + asiVars[p]);
        }
    }
}
else console.log('undefined!');
console.log('here!  ' + cb);

</script>


4D) Placement Calls Integrated to AudienceScience
Copy the code as it is in the example, but replace the corresponding placements.
Take the  green line from e-planning interface. (* See instructions below)

Ad request 1:
<script type='text/javascript' language='JavaScript'>
/*var asiPlacements = asiPlacements || top.asiPlacements;
var asiAdserver = asiAdserver || top.asiAdserver;
document.write('<scri'+'pt type='text/javascript' src='http://' + asiAdserver + '/rtbads/pq?mode=s&placement=DPxZet&adgroup=' + asiPlacements['DPxZet']['default'].key + '&blob=' + asiPlacements['DPxZet'].blob + ''></scri'+'pt>');*/

</script>
<script>eplAD4('Espacio_1',{t:1,timeout:0,ma:1,custF:null,wh:'300x250',sd:'1205d!Home!http://ads.e-planning.net/!!', kVs: { gwd: asiVars['DPxZet'] } });</script>


Ad request 2:
<script type='text/javascript' language='JavaScript'>
/*
var asiPlacements = asiPlacements || top.asiPlacements;
var asiAdserver = asiAdserver || top.asiAdserver;
document.write('<scri'+'pt type='text/javascript' src='http://' + asiAdserver + '/rtbads/pq?mode=s&placement=YppQzB&adgroup=' + asiPlacements['YppQzB']['default'].key + '&blob=' + asiPlacements['YppQzB'].blob + ''></scri'+'pt>');
*/
</script>
<script>eplAD4('Espacio_2',{t:1,timeout:0,ma:1,custF:null,wh:'160x600',sd:'1205d!FSN!http://ads.e-planning.net/!!', kVs: { gwd: asiVars['YppQzB'] } });</script>

Ad request 3:
<script type='text/javascript' language='JavaScript'>
/*
var asiPlacements = asiPlacements || top.asiPlacements;
var asiAdserver = asiAdserver || top.asiAdserver;
document.write('<scri'+'pt type='text/javascript' src='http://' + asiAdserver + '/rtbads/pq?mode=s&placement=6D9eVr&adgroup=' + asiPlacements['6D9eVr']['default'].key + '&blob=' + asiPlacements['6D9eVr'].blob + ''></scri'+'pt>');*/
</script>
<script>eplAD4('Espacio_3',{t:1,timeout:0,ma:1,custF:null,wh:'728x90',sd:'1205d!FSN!http://ads.e-planning.net/!!', kVs: { gwd: asiVars['6D9eVr'] } });</script>

 

*Last line of the Ad request:
It is the last line of the Ajax space in e-planning plus the addtion of color:
<script>eplAD4('Espacio_3',{t:1,timeout:0,ma:1,custF:null,wh:'728x90',sd:'1205d!FSN!http://ads.e-planning.net/!!', kVs: { gwd: asiVars['6D9eVr'] } });</script>