Jump to content

On Response

From Wiki Kaminari Click
Revision as of 15:04, 3 November 2026 by FuzzyBot (talk | contribs) (Updating to match new version of source page)

Подробнее о настройке On Response — в коротком видео: https://www.loom.com/share/1874474da7414f54be19032682b8e6ca

Если вы хотите сами решать что делать с фродовыми показами, и, например, в зависимости от источника трафика редиректить их на разные URL, вам поможет опция onResponse.

If you want to take control of handling fraudulent impressions yourself, for example, redirecting them to different URLs based on the traffic source, the onResponse option will assist you.

Обратите внимание, опция доступна только в интеграциях типа JS check.

Подключение опции

Закажите у менеджера включение опции onResponse на своей интеграции. После того как её включат, реализуйте её логику.

После реализации функции, она появится в поле window.kmnr.onResponse в сгенерированном коде скрипта, который вы можете скопировать кнопкой Copy и разместить у себя на странице в теге <body>.

Сигнатура

Функция принимает на вход объект { fraud, block }, где fraud может иметь значение 0 (хороший показ) или 1 (ботовый показ), а block может иметь значение 0 (хороший показ) или 1 (показ был заблокирован с соответствии с настройками интеграции).

fraud is 0 for a legitimate impression and 1 for a bot impression. block is 0 for a legitimate impression and 1 when the click was blocked according to the integration settings. reason is the IVT category behind the verdict, or an empty string.

reason is one of: Spoofing, Automated, Crawler, Bad reputation IP, Incorrect requests. In statistics, Crawler is labeled Crawlers.

reason is an empty string in four cases:

  • the impression is clean
  • the impression is suspicious; reason is filled only for an IVT category
  • the impression is a technical loss
  • block is 1 because of your IVT Settings (for example VPN, Tor, or proxy), and the impression has no IVT category
function(response) {
    if (response.block == 1) {
        // blocked click
        window.location = 'some.url';
    } else if (response.fraud == 1) {
        // bot
        window.location = 'some.url';
    } else {
        // not a bot
        showAd();
    }
}

Interaction with Traffic-back URL

If you have an integration with both the onResponse and Traffic-back URL options enabled, keep in mind that onResponse takes precedence. In this case, the Traffic-back URL will be ignored.