On Response

From Wiki Kaminari Click
Revision as of 15:40, 30 November 2023 by FuzzyBot (talk | contribs) (Updating to match new version of source page)
Other languages:

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.

Please note that this option is only available in JS check type integrations.

Option Activation

Request the activation of the onResponse option from your manager for your integration. Once enabled, implement its logic after activation.

On response.png

After implementing the function, it will appear in the window.kmnr.onResponse field in the generated script code, which you can copy using the Copy button and place on your page within the <head> tag.

On response2.png

Signature

The function takes as argument object { fraud }, where fraud can have a value of 0 (legitimate impression) or 1 (bot impression).

function(response) {
    if (response.fraud == 1) {
        // bot
        window.location = 'some.url';
    } else {
        // not a bot
        showAd();
    }
}

Interaction with Traffic-back URL

Если на вашей интеграции одновременно включены и опция onResponse, и опция Traffic-back URL, то поскольку onResponse обладает большим приоритетом, Traffic-back URL будет игнорироваться.