POST Ad API integration: usage
Overview
Equativ’s Ad API allows you to request and retrieve ads from Equativ using HTTP POST requests. The Ad API can be used in the following scenarios:
- server-side applications requesting ads from Equativ
- in-app implementations without Equativ's in-app display SDK (NB: Equativ’s SDK is strongly recommended for convenience and full feature support)
- any other environment (desktop, mobile web etc.) where client-side ad tags are not used (for more about ad tags, see Tagging guide: get started)
For a full reference of all parameters and objects of the HTTP POST Ad API, see Ad API integration: parameter reference.
Request methods (POST/GET)
Equativ’s current Ad API uses HTTP POST requests which has many advantages compared to the GET Ad API which uses HTTP GET requests. This “GET” Ad API is still in place and fully functional but is not recommended because it will be deprecated in the long term.
Request types
Equativ’s Ad API supports the following HTTP POST request types:
-
Generic POST request (
/genericpost
) to request each format on the page sequentially (single instance); the corresponding call in the GET Ad API is called “Standard call”; -
Onecall POST request (
/call
) to request all formats of the page in a single call (multi instance); -
Prebid POST request (
/prebid/v1
) to request ads in a client side header bidding context where Equativ is the bidder, not the ad server (see Supply inventory with prebid.js header bidding for details about this case); if Equativ is the ad server (see Set up and manage unified auction), the Generic POST/Onecall POST request types must be used
The responses (delivered ads) will differ depending on the format type (ad type) you are calling. Prior to calling ads, ask for confirmation that the format setup in the Equativ platform is correct (more about format creation in Create placements).
Authentication
There is no dedicated authentication but any POST ad request must contain the following information:
- the network Id - the ID of the network on Equativ’s system; any Equativ customer receives a dedicated network (work space) for inventory setup, campaign management, reporting etc.; special case: the network Id must not be added in case of instream video ad requests!
- the domain - the ad request domain that the given network is running on
One way to determine both network Id and domain is to:
- sign in to Monetization
- go to Administration > Websites & pages
- select any page in the left pane
- under Tags, expand the Generic function and check the
sas.setup
method; example:sas.setup({ networkid: 73, domain: "https://diff.smartadserver.com", async: true });
Headers
X-Forwarded-For header
The http header X-Forwarded-For is optional but strongly recommended — in particular in integrations where Equativ is being called server-side. In such server-side contexts, the proper setup of the X-Forwarded-For header ensures that Equativ gets the IP address of the end user, and not the IP of the server that is calling Equativ.
Sending multiple IPs in the X-Forwarded-For header (separated by comma) is possible but not recommended. If multiple IPs are sent, Equativ will consider the first (left most) IP address as the IP of the original client.
An error in the configuration of the “X-Forwarded-For” header can lead to a serious drop in revenue: for instance, the monetization may be stopped because the network is classified as invalid traffic; or a buyer may block some inventory since the erroneous IP address is seen as potentially malicious.
User agent
The user agent must be specified using the HTTP header User-Agent
.
In server side integrations, any Equativ pixels/events fired must have the same user agent as the ad call.
In case of mobile in-app calls, using the User-Agent
of the native browser of the device is strongly recommended. In case of iOS, this would be the User-Agent from a UIWebView
or WKWebView
. If the User-Agent
differs too much from the native one, some targeting options may stop working.
Ad request samples
Generic POST ad request sample
POST https://<domain>/genericpost
{
"timestamp":9623086048,
"networkId":73,
"siteId":1000025863,
"pageId":1000018300,
"master":"m",
"noAdCallback":"sas.noad",
"screen":{
"height":800,
"width":1280
},
"uid":123456,
"appName":"appName-test_01",
"bundleId":"bundId-tests01",
"schain": "1.0,0!exchange1.com,1234,1,bid-request-1,publisher,publisher.com",
"geolocation": {
"latitude": 48.8584,
"longitude": 2.2945
},
"ads":[
{
"formatId":"3569",
"tagId":"sas_3569",
"target":"foo=1",
"headerBidding":{
},
"isLazy":true
}
],
"eids":[
{
"source":"id5-sync.com",
"uids":[
{
"id":"ID5-55555",
"atype":1
}
]
}
],
"gdpr_consent":"CO3t7qmO3t7qmAKACAFRAxCMAP_AAAAAAAqIGPtV_T9fb2vj-_Z999tkeY1f97y3t-wjhgeMs-8NyZeX_B4Wr2MyvBX4JiQKGRgEunLBAQdlHGFcTQgAwIkFiTLMYk2MizNKJrJEilMbM2dYGG1Pn8XTuZCY70-tP__zv3-f-334GPEEmCpfAQJCWMBJNmlEKYEIVxAVIOASghGEg0sNCRQU7A4CPUACABAYAAQIAQAgohJBAAIAAElEQAgAwIBUARAIAAQAjQEIACJAEFgBIGAQACoGhYARRBKBIQYHBUcogQFSLRQQAA.IGPtV_T9fb2vj-_Z99_tkeY1f97y3t-wzhheMs-8NyZeX_B4Wv2MyvBX4JiQKGRgkunLBAQdtHGlcTQgBwIlViTLMYk2MjzNKJrJEmlsbO2dYGH9Pn8XT_ZKZ70-vv__7v3_f_334A"
}
Onecall POST ad request sample
POST https://<domain>/<network_id>/call
{
"timestamp": 6013045295,
"networkId": 73,
"siteId": 1000025863,
"pageId": 1000018300,
"master": "s",
"noAdCallback": "sas.noad",
"screen": {
"height": 1080,
"width": 1920
},
"uid": 0,
"appName": "",
"bundleId": "",
"schain": "",
"ads": [
{
"formatId": 3569,
"tagId": "sas_3569",
"target": "foo=1",
"headerBidding": {},
"isLazy": false,
"isAdRefresh": 0
}
],
"eids": [],
"gdpr_consent": "CO-dUnkO-dUn9ADABBDEBDCsAP_AAH_AAAAAGNoRxC4UTSFAaGJZAstACAweQAQEAkAABBKAAaABCRCAcIwGkAAAEACAAAAAAAAEoAIAAABAACEAAAAAQIAAAAAMAAAABAAAIAIACAEAAAAAAAAICAAQAQAIAAAEAAEAgABAABCBiwAIAqFAEAQEhgSQBJQAgACEAABAAAAAAQgAAgAAkQAGCMAhAAAAAAAAAAAAAAAKACAAAAAAABAAAAAECAAAAACAAAAAAAAAACAAAAAAAAAAAAAAAAEAAAAAAABAABAIAAAAAQCQgAAMAAEAABQAAYAAHAACAAAkAAKAAA.YAAAAAAAAAA",
"addtl_consent": "1~143.162.167.202.311.505.587.780.1126.1215.1364.1577.1750.3033",
"partnerExtUids": {}
}
Prebid POST ad request sample
POST https://<domain>/prebid/v1
{
"siteid": 1000025863,
"pageid": 1000018300,
"formatid": 3569,
"bidfloor": 5,
"ckid": 0,
"tagId": "div-gpt-ad-1484867557615-0",
"pageDomain": "https://demo.smartadserver.com/shared/smart/Rohan/PrebidOutstream.html?pbjs_debug=true",
"transactionId": "31ec153f-9ac6-4d7c-b9dd-a2c40a09d91e",
"timeout": 3000,
"bidId": "2dcc254d61c886",
"prebidVersion": "4.12.0",
"schain": null,
"isVideo": false,
"mediaType": "video",
"videoData": {
"videoProtocol": 8,
"playerWidth": 300,
"playerHeight": 250,
"adBreak": 2
}
}
Ad responses
Generic POST ad response sample (minified)
var sas;(sas=sas||{}).utils=sas.utils||{},sas.utils.cdns||(sas.utils.cdns={"http:":"http://ced-ns.sascdn.com","https:":"https://ced-ns.sascdn.com"}),(sas=sas||{}).utils=sas.utils||{},sas.events=sas.events||{},sas.rev=sas.rev||20110214,function(){sas.utils.cdns?(sas.utils.cdns["http:"]&&0!=sas.utils.cdns["http:"].length||(sas.utils.cdns["http:"]="http://ak-ns.sascdn.com"),sas.utils.cdns["https:"]&&0!=sas.utils.cdns["https:"].length||(sas.utils.cdns["https:"]="https://ec-ns.sascdn.com")):sas.utils.cdns={"http:":"http://ak-ns.sascdn.com","https:":"https://ec-ns.sascdn.com"};var t=function(){};sas.utils.getIEVersion=function(){var t=navigator.userAgent.match(/(?:MSIE |Trident\/.*; rv:)(\d+)/);return t?parseInt(t[1]):void 0},sas.events.addEvent=function(t,s,a){if(t&&s&&a)return t.attachEvent?t.attachEvent("on"+s,a):t.addEventListener&&t.addEventListener(s,a,!1),{removeEvent:function(){t.detachEvent?t.detachEvent("on"+s,a):t.removeEventListener&&t.removeEventListener(s,a,!1)}}},sas.events.addLoadEvent=function(t,s){if(t&&s){var a="load",e=function(){return!0};(sas.utils.getIEVersion()<11||t==document)&&(a="readystatechange",e=function(){if(!t.readyState||"complete"==t.readyState||"loaded"==t.readyState||4==t.readyState)return!0});var n=sas.events.addEvent(t,a,function(){e()&&(n.removeEvent(),s.apply(this,arguments))})}},sas.utils.Latch=function(t){for(var s=[],a={},e=t=t||[],n=!1,i=0;i<e.length;i++)a[t[i]]={};var c=function(){if(!n){for(var t in a)if(!a[t].status)return;n=!0;for(var e=d(),i=0;i<s.length;i++)s[i].apply(this,e)}},d=function(){for(var t=[],s=0;s<e.length;s++)t.push(a[e[s]].result);return t};this.notify=function(t,s){a[t]&&(a[t].status=!0,a[t].result=s,c())},this.addListener=function(t){null!=t&&(n?t():s.push(t))},c()},sas.utils._libs=sas.utils._libs||{};var s=function(t,s){return"/"==t.charAt(t.length-1)&&(t=t.slice(0,-1)),"/"==s.charAt(0)&&(s=s.slice(1)),t+"/"+s},a=function(t){"string"==typeof t&&(t=[t]);for(var a="https:"==document.location.protocol?sas.utils.cdns["https:"]:sas.utils.cdns[document.location.protocol]||sas.utils.cdns["http:"],e=0;e<t.length;e++)t[e]=s(a,t[e]);return t};sas.utils.loadLinkCdn=function(t){t=a(t);for(var s=0;s<t.length;s++)i(t[s],!0)},sas.utils.loadScriptCdn=function(t,s){t=a(t),sas.utils.loadScript(t,s)};var e=Math.floor(1e6*Math.random()),n=1;sas.utils._callbacks=sas.utils._callbacks||{};var i=function(t,s,a,i){var c,d=(s?"link":"script")+"-"+e+"-"+n++,r=document.createElement(s?"link":"script");r.id=d,r.setAttribute("type",s?"text/css":"text/javascript"),r.setAttribute(s?"href":"src",t),s&&r.setAttribute("rel","stylesheet"),!s&&a&&r.setAttribute("async","true"),sas.utils._libs[t]={loaded:!1,callbacks:[]},null!=i&&sas.utils._libs[t].callbacks.push(i),sas.utils._callbacks[d]=(c=t,function(){sas.utils._libs[c].loaded=!0;for(var t=0;t<sas.utils._libs[c].callbacks.length;t++)sas.utils._libs[c].callbacks[t]()}),s||a?(document.getElementsByTagName("head")[0].appendChild(r),sas.events.addLoadEvent(document.getElementById(d),sas.utils._callbacks[d])):(document.write(r.outerHTML),document.write("<script type='text/javascript'>(function() { sas.utils._callbacks['"+d+"'](); })();<\/script>"))};sas.utils.loadScript=function(s,a){(a=a||{}).async=null==a.async||a.async;var e=a.onLoad||t;"string"==typeof s&&(s=[s]);var n=new sas.utils.Latch(s);n.addListener(e);for(var c=0;c<s.length;c++){var d=s[c],r=function(t){return function(){n.notify(t)}}(d);sas.utils._libs[d]?sas.utils._libs[d].loaded?n.notify(d):sas.utils._libs[d].callbacks.push(r):i(d,!1,a.async,r)}}}(),function(){var t=document.getElementById("sas_3569");if(t){var s=document.createElement("div");s.style.display="none",t.appendChild(s)}else document.write("<div id='sas_3569'></div>");var a=window.sas,e=window.sas_ajax||!0,n={id:1000111766,formatId:3569,tagId:"sas_3569",instanceIndex:1,customScript:"",forcedIframeWidth:0,forcedIframeHeight:0,oba:0,viewability:{enabled:!1,area:50,duration:1,viewUrl:"http://localhost/track/action?uii=222189430561767452&opid=f352705f-0230-4855-8f72-9ee1aee62c63&opdt=1612456315&pid=1000018300&iid=1000111766&cid=1000113905&key=viewcount&sid=9623086048",errorUrl:"http://localhost/track/action?uii=222189430561767452&opid=f352705f-0230-4855-8f72-9ee1aee62c63&opdt=1612456315&pid=1000018300&iid=1000111766&cid=1000113905&key=viewerror&sid=9623086048"},creatives:[{id:"1000113905",type:1,url:"http://creatives-dev.sascdn.com/diff/73/1000111766/Rebel_Alliance_logo.svg.png",countUrl:"",clickUrl:"http://localhost/click?imgid=1000113905&insid=1000111766&pgid=1000018300&uid=123456&uii=222189430561767452&acd=1612456315889&opid=f352705f-0230-4855-8f72-9ee1aee62c63&opdt=1612456315&pubid=0&tmstp=9623086048&tgt=%24dt%3d1t%3bfoo%3d1%3b%24mct%3d1t%3b%24hc&systgt=%24qc%3d0%3b%24ql%3dUnknown%3b%24qt%3d0_0_0t%3b%24dma%3d0%3b%24b%3d9999%3b%24o%3d99999%3b%24sw%3d1280%3b%24sh%3d768%3b%24mdwi%3d800t%3b%24mdhi%3d800t&envtype=2&imptype=0&pgDomain=https%3a%2f%2fdemo.smartadserver.com%2fshared%2fsmart%2fRohan%2fGeneric_post.html&go=http%3a%2f%2fwww.google.fr",clickTarget:"_blank",width:"1200",height:"1200",pixelRatio:"1",altText:"",creativeScript:'<script type=\'text/javascript\'>console.log("?cid=1000032339&adid=1000111766&zid=3569&ezC=idPage:1000018300")<\/script>\x3c!--campagneid: 1000032339, insertionid: 1000111766, formatid: 3569, pageid:1000018300, target: %24dt%3d1t%3bfoo%3d1--\x3e<a href="http://www.smartadserver.com>smartadserver</a<',flashVars:"",version:"",wMode:"Opaque",backupImage:{id:"",type:1,url:"",clickUrl:"",clickTarget:"",width:"",height:"",altText:""}}]};a.utils.getIEVersion()<10&&!e?a.banner.render(n,{async:e}):a.utils.loadScriptCdn("/diff/templates/js/sas/sas-browser.js",{async:e,onLoad:function(){a.utils.loadScriptCdn("/diff/templates/js/sas/sas-dom.js",{async:e,onLoad:function(){a.utils.loadScriptCdn("/diff/templates/js/banner/sas-banner-2.2.js",{async:e,onLoad:function(){a.banner.render(n,{async:e})}})}})}})();
Onecall POST ad response sample
{
"sas_3569": {
"ScriptType": "script",
"ScriptSrc": "http://localhost/h/nshow?siteid=1000025863&pgid=1000018300&fmtid=3569&tag=sas_3569&tmstp=6013045295&visit=S&acd=1612456024977&opid=2b595f90-89c4-48f1-b46f-095a65cf2f13&opdt=1612456024&ckid=5510311462752007445&async=1&pubid=0&systgt=%24qc%3d0%3b%24ql%3dUnknown%3b%24qt%3d0_0_0t%3b%24dma%3d0%3b%24b%3d9999%3b%24o%3d99999%3b%24sw%3d1920%3b%24sh%3d1080&tgt=%24dt%3d1t%3bfoo%3d1&pgDomain=https%3a%2f%2fwww.mypage.com%2f&noadcbk=sas.noad&gdpr=-1&gdpr_consent=CO-dUnkO-dUn9ADABBDEBDCsAP_AAH_AAAAAGNoRxC4UTSFAaGJZAstACAweQAQEAkAABBKAAaABCRCAcIwGkAAAEACAAAAAAAAEoAIAAABAACEAAAAAQIAAAAAMAAAABAAAIAIACAEAAAAAAAAICAAQAQAIAAAEAAEAgABAABCBiwAIAqFAEAQEhgSQBJQAgACEAABAAAAAAQgAAgAAkQAGCMAhAAAAAAAAAAAAAAAKACAAAAAAABAAAAAECAAAAACAAAAAAAAAACAAAAAAAAAAAAAAAAEAAAAAAABAABAIAAAAAQCQgAAMAAEAABQAAYAAHAACAAAkAAKAAA.YAAAAAAAAAA&addtl_consent=1%7e143.162.167.202.311.505.587.780.1126.1215.1364.1577.1750.3033&insid=1000111766,&capp=1,&mcrdbt=1,",
"ScriptNoad": "http://localhost/h/aip?uii=222189430542762004&tmstp=6013045295&ckid=5510311462752007445&pubid=0&systgt=%24qc%3d0%3b%24ql%3dUnknown%3b%24qt%3d0_0_0t%3b%24dma%3d0%3b%24b%3d9999%3b%24o%3d99999%3b%24sw%3d1920%3b%24sh%3d1080&acd=1612456024977&envtype=0&opid=2b595f90-89c4-48f1-b46f-095a65cf2f13&opdt=1612456024&siteid=1000025863&tgt=%24dt%3d1t%3bfoo%3d1%3b%24hc&pgid=1000018300&fmtid=3569&statid=5&visit=s",
"FormatId": 3569
}
}
Javascript ad response
A javascript ad response is returned when
- the used format type is “Web” or “App (SDK)”; more details on format types in Create placements
- the
output
parameter is set tojs
The response will be a standard javascript code which must be executed in a javascript compliant environment.
HTML ad response
An HTML ad response is returned when the output
parameter is set to iframe
. For proper rendering, the code should be placed in an iframe or a webview. Alternatively, you can use the ad call as the source of the iframe.
HTML ad response sample
<img src='http://[subDomain].smartadserver.com:80/h/aip?visit=m&pubid=2&statid=18&ckid=386225520045089794&tmstp=%5btimestamp%5d&usrtgt=&tgt=%3b%24dt%3d1t%3b%24dma%3d501%3b%24hc&systgt=%24qc%3d1309588102%3b%24ql%3dmedium%3b%24qpc%3d10020%3b%24qpp%3d212%3b%24qt%3d152_1829_29211t%3b%24dma%3d501%3b%24b%3d12470%3b%24o%3d11061%3b%24sw%3d1920%3b%24sh%3d1200&rfr=&capp=0&mcrdbt=0&insid=5341644&imgid=0&pgid=677520&fmtid=40531&loguid=371361661459908448&logdate=1467394692545&sig=sCNtLLqNzn7UT8WEBIztAqbFvH7mGNUeF5npeM1IC0I%3d&rtb=1&rtbnid=1871&rtbbid=371361661459908449&rtbh=e8369927b30a065e264def603a1a4331230bf09a&rtblt=636029914925446102&rtbet=0' border='0' width='0' height='0' style='display:none'/><iframe src='https://ec-ns.sascdn.com:443/diff/rtb/handler/st.min.html?%7b%22bid%22%3a%22371361661459908449%22%2c%22adomain%22%3a%22justworks.com%22%2c%22page%22%3a%22677520%22%2c%22format%22%3a%2240531%22%2c%22crid%22%3a%2244_TTNVEBZYFJFFZBORJANMQH_300_250_1%22%2c%22dsp%22%3a%2231044%22%2c%22buyer%22%3a%223988%22%2c%22cid%22%3a%22TTNVEBZYFJFFZBORJANMQH%22%2c%22adid%22%3a%22%22%2c%22hash%22%3a%22-6438412222101877145%22%7d' width='0' scrolling='no' height='0' frameborder='0' style='display: none;'></iframe><iframe width="300" height="250" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" allowTransparency="true" src="http://us-east.bidswitch.net/imp/3.99/BSWhttp_A_B_Ba.adroll.com_Bj_Bbsw-snippet.html_Cwidth_R300_Jheight_R250_Jadspace__eid_RSV2SF2P76NFIPN7N5SDPHX_Jsite__eid_RISRFVJ4CYZEJLCRYPCOWW4_Jadgroup__eid_RZAYW3JDZD5ENJB5KOI64GA_Jad__payload_R____HIAgIBkwHaAfDIAewAAV2QwWvTUADG09jhQUR21NNw4G3jJa9pkyJIS9u1XVdtWtc1OOPLy0sppMmWpMWDHiaC7CQogriLTodjFQce-gdYpKLvRfG4g3cPjrGTCLK1Yycv3-HjO__y-30__uSrSvZqq10s2iVJJSBTVdzzfmavN19VJfy5SWtGrhhraYqqQzWiGbVyuVjNyv1cqL2bTWyBVzOS19XS2myguVfDLksrv21W3s2nbLJN61vgiEOIhDoHclXYA6dp3Ac-3ccJL____uzR77U__Bz8efNsa9sOtjYk5bv5j-cKtkFN__rXZedPwZgvxgRiB333kdx2k5TV2MyeDe0f0juv7eX0EebhOzhWax26YbYb2785C-__L__fjNLXA__pGpF__eipYpEmDQr8Nz0SchN7mrj2OZ0hHL__sHjweHg8NOr8JSF__h2eP7O2Tbot03X0gCWf039PwazEIpf3uCmRGDEEsalYkowSyIQyIsTAEIg4BhQLssj0HjdtWgQphoyRAUQFg5himCJESEZWwiKSISRtj__HcB7-NvACZPvG6xNMFOSEwPtKrjn9MLYyPMH4p5M6qFxnf6PmrK53micvRShswfjnk1jfvMP72iXnGfx7hQazAGIFEShBBgYasKHEABFkxIbYkJFksWhqwiZ2eRwLkNUkwUnsMrHGqZqW3XZB23M2P2g_Jurl__macro_Rsparcmedia.com_Jwin__notif_Rbsw-winners-us-east-1-rtb.adroll.com_U2Fwin_U2Fb_U3Fpayload_U3DAQAzYzkzNGUzZTU3ZTE5M2I4OTk2MDAxODlkM2NmNWE1ZgAIYQFQZWMyLTU0LTIwNC0yMDYtMjA0LmNvbXB1dGUtMS5hbWF6b25hd3MuY29tAAhoAAhmAAh0ALBUVE5WRUJaWUZKRkZaQk9SSkFOTVFIAAhjARgyNzA2ODY1NDM1MzI1NTEwMzUxMDA4MzA0NzczMjEzNjY1NgAIYgYYX19ISGpRR1RBZG9BZThkNEFBQ0hPTFpVVkU1V1JVSmFXVVpLUmtaYVFrOVNTa0ZPVFZGSU9zNEFSYTlzUnNjUkF0Q1ZoLTJCLVBEU2dzLWx4N2JPcFpzRlM4TE0tc2NOQTRHb1pYWnBaRzl1WDNUTk9wak1fWk13TGpYTkFTUGFBQ05rWm1WaE9XSTRZMkZpTURJNVl6QTBPV0prTWpOaFlUaGhaamRtWlRWaU1UcHNjcXhmU210dTdWVWtBQWVZRDc0AAhw_U26price__cpm__dollars_U3D_Jcpm__macro_R_I_WAUCTION__PRICE_X_Jclick__macro_R_I_WCLICK__URL_AURLENCODE_X/ewebKqCJc1FtiXaINOXv-t9ba30s9eE_tlW576AmdKt_itp8ag3wPeJszePkApRg23iDpkUXb7f_BxuQHwLRzjZhTKkwI0hGIYUk7REIykg28oDT2oGL6veTLmOo5t1jnm08lxoiyXRhm97ds4tcmN3P9EyI4baRI4sGmUhFDw6uMTm79dUY3uCg98uJ4lps8GaFTBH0n_OA2ObQUE3bqj4xhXxti_Yqnp76_vVtdEtGxkchmstMbLHJAp0A14y3GaPVZd0AqUhgBboDIU_HIXVxhg8pSXinB56dDt_4ynZ3eR8SAl-y6UkUoS_piKmrOAmDAztc6EntxnfiU8CQKCo9-yZrU9fOT2Euwpnc04lgTUA47CAWMoQ6WdW0KoNWDgtkQcp64wnPQyAxdem-DGxPBhu0cQRQVhEbGsk7I3mGHmhrcF7oXfxNEHVQNvBGUCYMU1esP9e9Z3t-yH242_XiefLvvfuhu1RZ6E-X9NdhFW8ayuJxTg0sktgECbbco5_TDpWIFw_ZPG4x5HmS7TRfyFo4yKriMnY/"></iframe><img src="http://us-east-sync.bidswitch.net/sync?ssp=smartadserver&dsp_id=44&imp=1" alt=" " style="display:none"/>
JSON ad response
A JSON object (named ad
) is returned when the used format type is “App (SDK)”; more details on format types in Create placements. The format of the JSON ad response is the same for both Equativ SDKs (iOS / Android) and contains the following elements:
Key | Type | Description |
---|---|---|
clickUrl |
STRING | optional; the clickURL which is used if the sas:click macro is set in the HTML5 creative |
closeAppearanceDelay |
INTEGER as STRING | optional; In case of interstitial ads, delays the appearance of the close button (in seconds); e.g.: closeAppearanceDelay:"5"
|
closeOnClick |
BOOLEAN as STRING | optional; in case of interstitial ads, indicates if the ad is closed when it was clicked by the user, e.g.: closeOnClick:"0"
|
closePosition |
INTEGER as STRING |
optional; in case of interstitial ads, indicates the position of the close button; not used if the creative calls the MRAID 1.0
|
confirmBeforeExiting |
BOOLEAN as STRING | iOS only; indicates whether to show an alert popup after a click on the ad to exit the app; e.g.: confirmBeforeExiting:"1"
|
countClickUrl |
STRING | the clickURL; returned only if the script itself does not call Equativ click pixel |
duration |
INTEGER as STRING | optional; in case of interstitial ads, indicates the duration of the interstitial ad before autoclose; -1 means infinite |
html |
STRING | the HTML script, represented as a JSON-escaped string; may be a complete HTML document or a fragment; returned only if scriptUrl is not defined |
impUrls |
STRING | one or more impression pixel URLs represented as a list of comma-separated strings; e.g.: impUrls: "pixelA.com,pixelB.com,pixelC.com" returned only if the script itself does not call Equativ impression pixel(s) |
openInApp |
BOOLEAN as STRING | optional; Android only; indicates whether to open the clickUrl in the postclick webview or in the Android webkit browser; e.g.: openInApp:"0"
|
portraitHeight |
INTEGER as STRING | optional; in case of a banner ads, indicates the height of the creative in portrait mode |
portraitWidth |
INTEGER as STRING | optional; in case of a banner ads, indicates the width of the creative in portrait mode |
redirectToThirdParty |
BOOLEAN as STRING | optional; iOS only; indicates if the URL should be handled by the postclick webview or by Safari e.g.: redirectToThirdParty:"1"
|
scriptUrl |
STRING | the URL pointing to the HTML script; in online mode, returned only if html is not defined |
transferTouchEvents |
BOOLEAN as STRING | optional; iOS only; more details here |
JSON ad response sample
{
"ad": {
"formatType": 0,
"scriptUrl": "",
"html": "<!DOCTYPE html><html><head><meta name=\"viewport\" content=\"viewport-fit=cover, initial-scale=1.0,maximum-scale=1.0\"/><style type=\"text/css\">* {-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-focus-ring-color:rgba(0,0,0,0);-webkit-touch-callout:none;-webkit-user-select:none;}body {margin:0;background-color:#ffffff}img {position:absolute;top:0;left:0;}#p,#l{-webkit-transition:opacity 0.3s ease-in;}</style><script src=\"mraid.js\"></script><script>var c={fit:0,p:{url:\"https://creatives.sascdn.com/diff/92/8279630/banner(0).jpg\",click:\"http://www.smartadserver.com\"},l:{url:\"https://creatives.sascdn.com/diff/92/8279630/banner(0).jpg\",click:\"http://www.smartadserver.com\"}};</script><script src=\"https://ns.sascdn.com/diff/templates/js/mobile/mraid/banner/sas-mraid-banner-1.2.4.js\"></script></head><body></body></html>",
"impUrls": "https://itx4.smartadserver.com/h/aip?uii=461443187108025542&tmstp=2338497313&ckid=0&pubid=12&systgt=%24qc%3d1314577168%3b%24ql%3dMedium%3b%24qpc%3d71640%3b%24qt%3d184_1346_275412t%3b%24dma%3d0%3b%24b%3d9999%3b%24o%3d99999%3b%24sw%3d1280%3b%24sh%3d768&acd=1612858265529&envtype=0&opid=4c1d554d-783b-47b4-86f3-4e04ee4e21cf&opdt=1612858265&siteid=104808&tgt=%24dt%3d1t%3b%24hc&vct=3&vrn=7.8.0&visit=V&statid=7&imptype=0&dntid=225D0EDC-A009-4D63-9414-8DFCB0B4EA51&capp=1&mcrdbt=0&insid=8279630&imgid=22743859&pgid=663262&fmtid=15140&isLazy=0&gdpr_consent=COu59xZOu59xZCsAAAENAPCAAAAAAAAAAAAAFoQAALQgAAAA.IFoEUQQgAIQwgIwQABAEAAAAO,",
"viewCount": [
{
"trackUrl": "https://ww1.smartadserver.com/track/action?sid=2338497313&pid=663262&iid=8279630&cid=22743859&sib=0&key=viewcount",
"duration": "1",
"area": "50"
}
],
"countClickUrl": "https://ww1.smartadserver.com/h/cp?imgid=22743859&insid=8279630&pgid=663262&ckid=0&uii=461443187108025542&acd=1612858265529&opid=4c1d554d-783b-47b4-86f3-4e04ee4e21cf&opdt=1612858265&pubid=12&tmstp=2338497313&tgt=%24dt%3d1t%3b%24hc&systgt=%24qc%3d1314577168%3b%24ql%3dMedium%3b%24qpc%3d71640%3b%24qt%3d184_1346_275412t%3b%24dma%3d0%3b%24b%3d9999%3b%24o%3d99999%3b%24sw%3d1280%3b%24sh%3d768&envtype=0&imptype=0&clickcapp=1&dntid=225D0EDC-A009-4D63-9414-8DFCB0B4EA51&vct=3&vrn=7.8.0",
"closePosition": "1",
"redirectToThirdParty": "0",
"clickUrl": "http://www.smartadserver.com",
"deepLinkUrl": "",
"portraitWidth": "1080",
"portraitHeight": "150",
"extraParameters": {
"templateId": "84695",
"advertiserId": "100502",
"campaignId": "1047323",
"insertionId": "8279630",
"creativeId": "22743859"
},
"trackingScript": ""
}
}
Video ad response
A video ad response is returned when a video object is declared and the output
parameter is set to vast
or a specific VAST version. The response is a VAST XML following the VAST 4.x / VAST 3.0 / VAST 2.0 standard.
No ad response
A No ad response is returned when Equativ cannot find any ad for a given request. The format of this response depends on the requested ad type (web, in-app, video).
No ad response - web
- response status is
200 OK
; - content is a javascript
sas_noad
variable:sas_noad = true;
- executing the callback
onNoad
returns an object which includes theformatID
andtagID
; for more about this callback, read chapter "Managing empty ad responses (noad)" in the Tagging guide: get started
No ad response - in-app
- response status is
200 OK
; - response body is left empty
No ad response - video
- response status is
200 OK
; - content is a standard VAST Error XML:
<?xml version="1.0" encoding="UTF-8"?>
<VAST version="3.0">
<Error>
<![CDATA[http://www.smartadserver.com/shim.gif]]>
</Error>
</VAST>
- in some cases, the video no ad response may return Equativ's user sync URL to improve the user synchronization rate