Website Code command

https://www.popads.net/api/website_code?key=<your API key>
	&website_id=<your website ID>
	[&aab=<anti-adblock>]
	[&mb=<minimal bid>]
	[&ppip=<popunders per IP>]
	[&db=<delay between>]
	[&dpd=<default per day>]
	[&tl=<topmost layer>]
	[&of=<obfuscate code>]
	[&def=<default code>]

Generates adcode for given website.

website_id=id1,id2...
Specifies, for which website the adcode has to be generated
mb=0|float
Minimal rate accepted for one popunder.
ppip=integer
The number of times a popunder should appear for the same visitor in 24 hours. Set 0 to disable limiting of popunders per visitor.
db=integer
Minimal number of seconds between opening popunders. Set 0 to disable.
dpd=integer
Number of times default code/URL can be loaded when we have no advertisers for your visitor. Set 0 to disable limiting.
tl=0|1
Enables or disables overlay used to capture click events from Flash controls.
aab=0|1
Whether to generate normal adcode, or Anti-Adblock adcode.
of=0|1
Whether to obfuscate parts of adcode. This setting is 0 by default, when Anti-Adblock is also disabled, and 1 by default otherwise.
def=string
Default JS code executed, when no advertisements are available for given visitor. Remember to properly encode this argument.

This command allows to specify text/plain content type in Accept header. When JSON and plain have identical priority, the plain format is preferred. Example (plain):

https://www.popads.net/api/website_code?key=2513b194f41759c0c20c92b9fd1b5e968618ce54&website_id=123456&aab=1&of=1
<!-- PopAds.net Popunder Code for example.net | 2016-07-29,123456,0,0 --> <script type="text/javascript" data-cfasync="false"> (function(){ var f=window;f["\u005f\u0070\x6f\u0070"]=[["\u0073\u0069\u0074\u0065I\u0064",123456],["m\u0069\x6e\x42\x69\x64",0],["\u0070\x6f\u0070\u0075n\x64\x65\x72s\x50\x65\u0072\u0049\u0050",0],["\x64\u0065\u006c\u0061y\u0042et\x77\x65en",0],["d\u0065fa\x75\u006ct",false],["\x64\x65\u0066\u0061\u0075l\u0074\u0050\x65\u0072\u0044a\x79",0],["\u0074op\u006d\x6f\x73tL\u0061y\u0065\u0072",!1]];var y=["\u002f\x2f\u0063\x31\x2e\u0070\u006f\x70\u0061\x64\x73.\u006e\u0065\x74\u002fp\u006f\x70\u002e\x6as","/\x2f\u0063\u0032\x2e\u0070\x6f\u0070\x61\u0064\x73\x2enet/\x70\x6f\x70.j\u0073","\u002f\u002f\u0077\x77w.\x68\u0078\x62\u0076\u0062\x6d\u0078\u0076\u002e\u0063\x6f\x6d\x2f\x76\u0067\u0072f\x2ej\x73","\x2f\u002fwww.s\x75a\x6czm\x7a\x65\u002e\u0063\u006fm/\u0078\x65oz.j\x73",""],d=0,k,e=function(){k=f["do\u0063u\u006d\u0065n\u0074"]["c\u0072e\x61t\u0065\x45l\x65\x6d\x65\u006e\u0074"]("\x73\x63\x72ip\u0074");k["\x74\x79\u0070\u0065"]="t\x65\x78\u0074\x2fj\u0061\u0076a\x73\x63rip\u0074";k["as\x79\u006e\x63"]=!0;var o=f["do\u0063\x75m\x65\u006e\u0074"]["\u0067\u0065tE\u006cem\x65\u006et\x73\x42\x79\u0054\x61\x67\u004ea\u006d\x65"]("s\u0063rip\x74")[0];k["\x73r\x63"]=y[d];k["\x6fn\u0065rr\x6f\u0072"]=function(){d++;e()};o["\u0070\x61re\x6e\x74\x4eo\u0064e"]["\u0069\u006e\x73e\x72\x74\u0042ef\u006fr\u0065"](k,o)};e()})();</script>

Here's another example, with application/json Accept header, and no obfuscation nor Anti-Adblock.

https://www.popads.net/api/website_code?key=2513b194f41759c0c20c92b9fd1b5e968618ce54&website_id=123456&aab=0&of=0
"<!-- PopAds.net Popunder Code for example.net -->\n<script type=\"text\/javascript\" data-cfasync=\"false\">\n var _pop = _pop || [];\n _pop.push(['siteId', 123456]);\n _pop.push(['minBid', 0]);\n _pop.push(['popundersPerIP', 0]);\n _pop.push(['delayBetween', 0]);\n _pop.push(['default', false]);\n _pop.push(['defaultPerDay', 0]);\n _pop.push(['topmostLayer', false]);\n (function() {\n var pa = document.createElement('script'); pa.type = 'text\/javascript'; pa.async = true;\n var s = document.getElementsByTagName('script')[0]; \n pa.src = '\/\/c1.popads.net\/pop.js';\n pa.onerror = function() {\n var sa = document.createElement('script'); sa.type = 'text\/javascript'; sa.async = true;\n sa.src = '\/\/c2.popads.net\/pop.js';\n s.parentNode.insertBefore(sa, s);\n };\n s.parentNode.insertBefore(pa, s);\n })();\n<\/script>\n<!-- PopAds.net Popunder Code End -->"

An error also might occur. Such requests will return with code 500. Example:

https://www.popads.net/api/website_code?key=2513b194f41759c0c20c92b9fd1b5e968618ce54&website_id=12456&aab=0&of=0
{"errors":[{"status":500,"code":33,"title":"Website not found"}]}

In rare cases, when using Anti-Adblock feature, a following error can appear (but it really should not). Try to acquire new adcode a bit later.

{"errors":[{"status":500,"code":20,"title":"No valid domains in pool"}]}

If you would, for example, decide to query our API for adcode every single page view, you might expect such result as below. It is recommended to ask for adcode about once a day - this should be perfectly enough to avoid being blacklisted. Of course, you can gather new adcode more frequently, but try not to do it more than once per hour.

{"errors":[{"status":500,"code":86,"title":"Rate limit exceeded"}]}