Request
Request Parameters
Note: The request is made in JSON format using HTTP POST.
Note: It is possible to request many ad zones in a single request. Each zone will have a different ID, as you can see in the example below.
Note: You can add keywords to your request that will manually match the ad zone to the type of advertising you want. If there are no keywords, the URL of the site will be used for matching.
User
Below are the parameters used in the request: The Ad Placement API can be called from either client side or server side:
When using API on client side, IP is not actually required (as it can be difficult to detect IP using frontend and Javascript).
Instead, our API detects the IP from the connection when the request is made.
Whether client or server is used, if an IP is passed, it will be prioritised over the one we detect.
When called from the server side, in order to ensure correct targeting, the correct IP of the user should be passed explicitly as a parameter. Otherwise, ads will be targeted for server location and this may cause impressions to be invalidated by an IP mismatch later.
When using client-side implementation, the browser may perform a pre-flight request. If you wish to avoid this, in the request header, use
Content-Type: text/plain
. This will ensure that the browser qualifies the request as "simple" and therefore skips the pre-flight request.
Parameter | Description |
---|---|
id | The ID of the user |
ip | The user IP address. |
ua | The User Agent: A string containing the user's browser/app and device/OS. |
language | Sets the language of the request using the standard two-character ISO code plus an optional 2-character region code. e.g. en-us for United States English. |
referer | The address of the site where the ad will be shown. |
el | The Base64-encoded email of the user. |
gdpr | Privacy advised extensions (Optional). |
buyeruids | List of buyer uids* (Optional). |
* json_encoded and then base64_encoded array
Example
{
"platform1": "C9446DA7-BB76-44B9-B260-77E16530AA03",
"platform2": "6372709574547581900",
"platform3": "456621142600017315",
"platform4": "3952063610783032691",
"platform5": "KX3KMRTI-11-ZMP",
"platform6": "402e4b19ff476fb23de2c97ebe62a47b",
"platform7": "bu7zD7LkVT2huSwTSvou"
}
user.gdpr
Parameter | Description |
---|---|
gdpr | This should be 0 if the caller believes that the user is not under GDPR, and 1 if the user is under GDPR . |
consent | This is the consent string required by the IAB Standards. |
Zones
Parameter | Description |
---|---|
id | The ID of the ad zone |
sub | The Sub ID of the ad zone (optional) |
keywords | You can insert keywords into the code in your ad zone to manually match it to the type of advertising you want (optional). |
custom_targeting | If Custom Targeting is available, will filter campaigns based on the key/value structure provided. {"custom_targeting": {"ex_car-brand": "mercedes", "ex_credit-score": "300"}} |
Banner Request Example: JSON
{
"user": {
"id": "abdef8u9",
"ip": "10.42.0.1",
"ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.63 Safari/537.36",
"language": "en-US",
"referer": "https://blabla.com",
"gdpr" : {
"gdpr" : 1,
"consent": "CPAoZRHPArq3hBcADBENBJCgAAAAAAAAAAqIHKQAAOUgAAAA"
},
"buyeruids":"ewoJInBsYXRmb3JtMSI6ICJDOTQ0NkRBNy1CQjc2LTQ0QjktQjI2MC03N0UxNjUzMEFBMDMiLAoJInBsYXRmb3JtMiI6ICI2MzcyNzA5NTc0NTQ3NTgxOTAwIiwKCSJwbGF0Zm9ybTMiOiAiNDU2NjIxMTQyNjAwMDE3MzE1IiwKCSJwbGF0Zm9ybTQiOiAiMzk1MjA2MzYxMDc4MzAzMjY5MSIsCgkicGxhdGZvcm01IjogIktYM0tNUlRJLTExLVpNUCIsCgkicGxhdGZvcm02IjogIjQwMmU0YjE5ZmY0NzZmYjIzZGUyYzk3ZWJlNjJhNDdiIiwKCSJwbGF0Zm9ybTciOiAiYnU3ekQ3TGtWVDJodVN3VFN2b3UiCn0="
},
"zones": [
{
"id": 4031007,
"sub": 111,
"keywords": "humour, general",
"custom_targeting": {
"ex_car-brand": "name",
"ex_credit-score": "300"
}
},
{
"id": 4031015,
"sub": 222,
"custom_targeting": {
"ex_car-brand": "name"
}
},
{
"id": 4031019,
"sub": 222
}
]
}