Native SDK
From Service Manual Kadam.net
Native SDK differs from other formats in that the site owner himself is engaged in placing and displaying the advertising block on the page.
Contents
[hide]Setup
To use Native SDK, you should connect the library to the site by placing the library call code in the < head > block of your site, and set the variable with the advertising domain.
<head> <script> var kdmDomain = 'hdbcode.com'; </script> <script src="https://hdbcode.com/abcdef.js"></script> </head>
Usage
Once SDK is connected, a feature call will be available to get a list of ads window.getKdm(options)
Options object description
Parameter name | Data type | Description | Notes | Need |
---|---|---|---|---|
blockId | integer | ID of an Ad block | Available from the Advertising Cabinet Interface | Obligatory |
imgWidth | integer | Picture height | Obligatory | |
imgHeight | integer | Picture width | Obligatory | |
amount | integer | How many promotional offers should be returned | The default is 1 | Optional |
showAdDescription | boolean | Send an ad description or not | The default is false | Optional |
subDomains | integer | How many subdomains (excluding top-level domain) to leave in location.host and location.href when sending domain and page parameters to the server | The default value is 0. The sub2.sub1.test.com domain name with subDomains = 1 will turn into a test.com; at subDomains = 2 - in sub1.test.com | Optional |
callback | Function([Object]) | A function that will be called after receiving a response from the server | An array with objects containing promotional materials is passed to the function argument (see description below) | Obligatory |
Ad Receiving Example
window.getKdm({ blockId: 311785, amount: 1, imgWidth: 200, imgHeight: 250, showAdDescription: true, callback: function(data) { console.log(data); } });
Description of the parameters of the promotional material object
After sending the request, the response will be sent to the callback function, an array of advertising materials is passed as an argument.
Parameter name | Data type | Description | Notes | Need |
---|---|---|---|---|
description | string | Ad description | Optional | |
title | string | Title | Obligatory | |
image | URL | URL of the image | Obligatory | |
url | url | URL of the click | Obligatory | |
calcCpm | float | Calculated CPM | Estimated cost of 1000 displays of this material | Obligatory |
cpcCost | float | Cost per click | Obligatory | |
payMode | integer | 0 — CPC; 2 — CPM; 4 — CPATarget | Obligatory | |
cur | string | Payment currency | USD, RUB | Obligatory |
campaignID | integer | Obligatory | ||
adID | integer | Obligatory | ||
notificationFunction | Function(void) | The function you want to invoke in an ad display (or when an ad hits the visible area) | Should be used only if the notify function is not suitable | Obligatory |
nofity | Function(Object) | A function that will automatically detach the display of an ad after it hits the scope within the specified time | If the tapping conditions are more complicated, you can independently implement them and forget about the display using notificationFunction | Obligatory |
target | HTMLElement | Link to Creative DOM | Obligatory | |
delay | integer | How many milliseconds the ad should be in the visible area | The default is 1000 | Optional |
visibilityPercent | integer | What percentage of the ad should be in the visible area | The default is 50 | Optional |