Anura Docs

Anura Integration Guide

We offer two simple, but flexible native integration methods: Anura Script, which uses JavaScript and Anura Direct, which is a REST API.

1. Anura Script is our preferred integration method as it is robust, enabling it to capture and identify more fraud in client campaigns. We encourage all integrators to use Anura Script, wherever possible, to provide the most insight possible.

2. Anura Direct is for fast, pre-bid analysis of traffic quality and is ideal for time-sensitive traffic analysis often associated with click and programmatic campaigns.

When in doubt, don't take the lazy way out! Use Anura Script to get the best bang for your buck. Use Anura Direct when you're in a pinch and need a quick response, or when your application does not allow for the use of JavaScript.

Script Integration

Anura Script is our preferred integration method as it is robust, enabling it to capture and identify more fraud in client campaigns. We encourage all integrators to use Anura Script, wherever possible, to provide the most insight possible.

The code examples displayed on this page attempt to demonstrate the "Request. Response. Result." process by which Anura Script operates.

What follows is a hypothetical process of putting Anura Script on a website, interacting with the response object, and performing a server-side query to obtain a result value using the returned response ID.

We know not everyone is a developer, therefore, we've created a wizard where you're able to create your own semi-custom integrations! You can find it under the "Integration" tab in the Anura Dashboard or by going directly to the Anura Integration Wizard.

Script Integration - Request

Placing the Anura Script at the end of your page's <head> tag will create a "request" which allows Anura to obtain "response" data and generate a "result" value for each visitor to your site.

JavaScript
<script type="text/javascript">
// FOR DEMONSTRATION PURPOSES ONLY!
(function(){
    var anura = document.createElement('script');
    if ('object' === typeof anura) {
        var request = {
            instance: yourAssignedInstanceId,
            source: 'optionalSourceTrackingId',
            campaign: 'optionalCampaignTrackingId',
            callback: 'optionalCallbackFunction'
        };
        var params = [Math.floor(1E12*Math.random()+1)];
        for (var x in request) params.push(x+'='+encodeURIComponent(request[x]));
        anura.type = 'text/javascript';
        anura.async = true;
        anura.src = 'https://script.anura.io/request.js?'+params.join('&');
        var script = document.getElementsByTagName('script')[0];
        script.parentNode.insertBefore(anura, script);
    }
})();
</script>

The JavaScript example shown above demonstrates adding Anura Script to a page with a source value of 'optionalSourceTrackingId' and campaign value of 'optionalCampaignTrackingId' that will execute a callback function called 'optionalCallbackFunction' when finished.

Anura Script may also be added to your page using a "one line" piece of JavaScript, as some platforms and integrations do not allow for the use of full scripts.

JavaScript
<script type="text/javascript" src="https://script.anura.io/request.js?instance={INSTANCE_ID}&source={MACRO}&campaign={MACRO}&{CACHEBUSTER}"></script>

Please ensure the replacement of example macro values with their actual values when using a "one line" integration.

Parameter string values must be URL encoded when using a "one line" integration.

Parameters

Required Type Description Note
instance integer Your assigned instance ID.
Optional Type Description Note
source string A variable, declared by you, to identify "source" traffic within Anura's dashboard interface. Source strings should be limited to a reasonable number of unique values. Unique values, such as click IDs, should be passed using Additional Data.
campaign string A subset variable of "source," declared by you, to identify "campaign" traffic within Anura's dashboard interface. Campaign strings should be limited to a reasonable number of unique values. Unique values, such as click IDs, should be passed using Additional Data.
exid string A unique, one-time, single-use external ID, declared by you, that is used to query for a specific result from Anura. EXID values may not be re-used until the initital result has been queried from Anura's servers. A response status code of 540 will be returned when an EXID is unavailable for re-use.
additional string An array of Additional Data declared as a JSON encoded string. Read more about using Additional Data.
variable string The variable name of the JavaScript object that response object functions will be assigned to. This window variable contains the response ID, in addition to other important data, that will allow you to make real-time decisions. Anura is declared by default.
callback string The name of a declared JavaScript function to be executed once the response is received. Response object functions are passed to the callback as the first argument.
cachebuster * integer A random multi-digit integer added to the end of the query string to prevent caching of Anura's Script. * The "cachebuster" value should only be added when using "one line" script implementations.

Source, campaign, exid, variable, and callback parameters are limited to a maximum of 128 characters.

Source and campaign parameters may not equal the following values: "all sources", "all campaigns", "&", "*", "?", "%".

Variable and callback parameters are allowed to start with: "$", "_", or "a-z" characters, followed by "a-z" and "0-9" characters.

HTTP and User-Agent Client Hints

In order to more accurately identify visitors, Anura Script makes use of HTTP and user-agent client hints that are provided by some modern web browsers. Permission to receive HTTP and user-agent client hints, however, must first be allowed by the referring website. Whenever possible, it is recommended to add both of the following Accept-CH and Permissions-Policy HTTP response headers to any page where Anura Script will be executed.

Accept-CH
Accept-CH: Device-Memory, Content-DPR, DPR, Viewport-Width, Width, Sec-CH-UA-Arch, Sec-CH-UA-Bitness, Sec-CH-UA-Form-Factors, Sec-CH-UA-Full-Version, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Mobile, Sec-CH-UA-Model, Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version, Sec-CH-UA-WoW64
Permissions-Policy
Permissions-Policy: ch-device-memory=(self "https://*.anura.io"), ch-content-dpr=(self "https://*.anura.io"), ch-dpr=(self "https://*.anura.io"), ch-viewport-width=(self "https://*.anura.io"), ch-width=(self "https://*.anura.io"), ch-ua-arch=(self "https://*.anura.io"), ch-ua-bitness=(self "https://*.anura.io"), ch-ua-form-factors=(self "https://*.anura.io"), ch-ua-full-version=(self "https://*.anura.io"), ch-ua-full-version-list=(self "https://*.anura.io"), ch-ua-mobile=(self "https://*.anura.io"), ch-ua-model=(self "https://*.anura.io"), ch-ua-platform=(self "https://*.anura.io"), ch-ua-platform-version=(self "https://*.anura.io"), ch-ua-wow64=(self "https://*.anura.io")

Read more about HTTP Client Hints and Permissions Policy.

Security

Anura Script offers an optional "domain locking" feature to protect against unauthorized use of your instance ID. Once enabled, only requests from authorized domains will be accepted. Talk to support for more information about domain locking.

Script Integration - Response

If you want to be proactive and use response data to make decisions within the context of your page you will need to access the Anura Script response object functions using an optional callback function.

Optional Callback Function

JavaScript
<script type="text/javascript">
// FOR DEMONSTRATION PURPOSES ONLY!
function optionalCallbackFunction() {
    // if the Anura object has been declared
    if (!!Anura) {
        // declare your back-end server response handler function
        function backendServerResponseHandler() {
            // redirect the user to the returned destination url
            window.location = this.responseText;
        }
        // send the response ID to your back-end server for result-based redirection
        var http = new XMLHttpRequest();
        http.addEventListener('load', backendServerResponseHandler);
        http.open('POST', 'https://anura.io/example-redirect');
        http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
        http.send('responseId='+Anura.getAnura().getId());
    }
}
</script>

The JavaScript example shown above demonstrates a basic callback that will send the returned response ID to a back-end server using the getId() response object function. The back-end server in this example will be querying the Anura result endpoint and returning a destination URL to which the visitor will be redirected.

Querying the result endpoint from server-side, using a response ID, or EXID, is the most secure way to actively use Anura, as there is little or no exposure of sensitive result data on the client-side.

Response Object Functions

Function Description Note
getId() Returns the Anura response ID used to query the result from Anura's servers.
getExId() Returns the self-declared external tracking ID used to query the result from Anura's servers.
hasResult() Returns true when the result value is available.
queryResult(callback) A function used to query the result value from Anura's servers within the context of your JavaScript code. The queryResult() function should be executed from your response callback and may only be used once per session. The response ID, or EXID, is automatically referenced from response data and does not need to be declared. The callback parameter is used to execute a declared callback function, which may also be passed anonymously. Response object functions are passed to the callback as the first argument.
isGood() Returns true when the result value is "good". Requires full response or prior use of the queryResult() function.
isWarning() Returns true when the result value is "warn". Requires full response or prior use of the queryResult() function.
isBad() Returns true when the result value is "bad". Requires full response or prior use of the queryResult() function.
getResult() Returns the result value string. Requires full response or prior use of the queryResult() function.
getRuleSets() Returns an array of broken rule sets. Return rule sets must be enabled. Requires full response or prior use of the queryResult() function.
getInvalidTrafficType() Returns the type of invalid traffic: "SIVT" or "GIVT". Return invalid traffic type must be enabled. Requires full response or prior use of the queryResult() function.
isMobile() Returns true when a mobile device has been detected Requires full response or prior use of the queryResult() function.
getMobile() Returns the numeric value of mobile device detection: 0 or 1. Requires full response or prior use of the queryResult() function.
hasAdBlocker() Returns true when an ad blocker has been detected. Ad blocker detection must be enabled. Requires full response or prior use of the queryResult() function.
getAdBlocker() Returns the numeric value of ad blocker detection: 0 or 1. Ad blocker detection must be enabled. Requires full response or prior use of the queryResult() function.
getError() Returns an error message if one has been declared.
getResponseObject() Returns an object of available response data.
getResultObject() Returns an object of available result data. Requires prior use of the queryResult() function.
getObject() Returns a combined object of available response and result data.

If you do not specify the variable parameter when making a script request, "Anura" will be declared by default.

A "full response" is available, which provides result data immediately and without the need to connect to the result endpoint. Talk to support about enabling or disabling the full response feature.

Ad blocker detection may be enabled or disabled per instance. Talk to support about whether having the ad blocker detection feature turned on/off is right for you.

Refer to our callback functions documentation for more information about what data values are available and when.

Script Integration - Result

Anura Script result values may be obtained by calling the endpoint directly.

Method URL Note
GET, POST https://script.anura.io/result.json HTTPS recommended

Example Request

PHP
<?php // FOR DEMONSTRATION PURPOSES ONLY!
// declare an array of request parameters
$params = array();
$params["instance"] = yourAssignedInstanceId;
$params["id"] = $_POST["responseId"];
// declare curl options
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://script.anura.io/result.json?".http_build_query($params));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// execute and decode the returned json string
$response = json_decode(curl_exec($curl));
// output the redirection url based on the returned result value
echo isset($response->result) && $response->result === "good" ? "https://anura.io/protected-resource": "https://anura.io/not-found";
?>

The PHP example above completes our demonstration, using the POSTed response ID and performing a cURL request to the Result endpoint. If the returned result value is found to be GOOD the user will be redirected to a protected resource. Whereas, if the user is WARN or BAD, they will be redirected to a page that is not found.

Parameters

Required Type Description Note
instance integer Your instance ID.
id string The response ID that is used to request the result value from Anura's servers.
Optional Type Description Note
exid string The unique external tracking ID, declared by you, that is used to query the result from Anura's servers. Send "exid" instead of "id" when using the exid parameter.

Depending on your integration, multiple queries to the result endpoint may be required. We find this to be an acceptable practice within reason.

Response ID results will be available for 15 minutes and are removed immediately after a successful result query.

Example Response

{
    "result": "bad",
    "mobile": 1,
    "adblocker": 0,
    "rule_sets": [
        "UE",
        "SP"
    ],
    "invalid_traffic_type": "SIVT"
}

Result Values

Result Description
good The visitor has passed our tests and appears to be trustworthy.
warn There are aspects about the visitor that raise concerns. However, we cannot say for certain they are bad. It is your decision how to interpret this value.
bad The visitor has failed our testing and should be considered untrustworthy.

Refer to our script result definitions documentation for more information on these values.

Rule Set Values

Result Description
DI Data Integrity
UE User Environment
DC Data Center
TO Traffic Origin
IP IP Integrity
SP Spoofing
WC Web Crawler

The "rule_sets" array requires "return rule sets" to be enabled. Talk to support about enabling or disabling the return rule sets feature.

The "invalid_traffic_type" string requires "return invalid traffic type" to be enabled. Talk to support about enabling or disabling the return invalid traffic type feature.

Refer to our rule set definitions documentation for more information on these values.

Direct Integration

Anura Direct is for fast, pre-bid analysis of traffic quality and is ideal for time-sensitive traffic analysis often associated with click and programmatic campaigns.

Direct Integration - Endpoint

Direct result values may be obtained by calling the endpoint directly.

Method URL Note
GET, POST https://direct.anura.io/direct.json HTTPS recommended

Example Request

PHP
<?php // FOR DEMONSTRATION PURPOSES ONLY!
// declare an array of request parameters
$params = array();
$params["instance"] = yourAssignedInstanceId;
$params["source"] = "optionalSourceTrackingId";
$params["ip"] = "visitorIPAddress";
// declare curl options
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://direct.anura.io/direct.json?".http_build_query($params));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// execute and decode the returned json string
$direct = json_decode(curl_exec($curl));
// redirect based on the returned result value
header("Location: ".(isset($direct->result) && $direct->result === "non-suspect" ? "https://anura.io/protected-resource": "https://anura.io/not-found"));
?>

The PHP example above demonstrates a cURL request to the Direct endpoint, including a source value of 'optionalSourceTrackingId' and the visitor's IP address. If the returned result value is found to be NON-SUSPECT the user will be redirected to a protected resource. Whereas, if the user is SUSPECT they will be redirected to a page that is not found.

Parameters

Required Type Description Note
instance integer Your instance ID.
ip string The IP address of your visitor. IPV6 addresses are also supported.
Optional Type Description Note
source string A variable, declared by you, to identify "source" traffic within Anura's dashboard interface.
campaign string A subset variable of "source," declared by you, to identify "campaign" traffic within Anura's dashboard interface.
ua string The user agent string of your visitor. Do not modify the user agent string of your visitor. Modifications to the user agent string may cause adverse results.
app string The application package identifier of your visitor (when available.) Also referred to as: app ID, bundle ID, package name, etc.
device string The device identifier of your visitor (when available.)
additional string An array of Additional Data declared as a JSON encoded string. Read more about using Additional Data.

Source and campaign parameters are limited to a maximum of 128 characters.

Source and campaign parameters may not equal the following values: "all sources", "all campaigns", "&", "*", "?", "%".

Security

Anura Direct offers an optional "Authorized IP Addresses" locking feature to protect against unauthorized use of your instance ID. Once enabled, requests will only be accepted from client authorized IP addresses. Talk to support for more information about the Anura Direct authorized IP addresses locking feature.

Example Response

{
    "result": "suspect",
    "mobile": null,
    "rule_sets": [
        "IP"
    ],
    "invalid_traffic_type": "GIVT"
}

Result Values

Result Description
suspect Based on available data; we have determined the visitor to be suspect.
non-suspect Based on available data; we have determined the visitor to be non-suspect.

Refer to our direct result definitions documentation for more information on these values.

Rule Set Values

Result Description
UE User Environment
DC Data Center
IP IP Integrity
WC Web Crawler

The "rule_sets" array requires "return rule sets" to be enabled. Talk to support about enabling or disabling the return rule sets feature.

The "invalid_traffic_type" string requires "return invalid traffic type" to be enabled. Talk to support about enabling or disabling the return invalid traffic type feature.

Refer to our rule set definitions documentation for more information on these values.

Additional Data Integration

Additional Data gives Anura users the ability to pass in select points of data with their Script or Direct requests, essentially turning Anura into "your database for transactional data".

Data Structure

Additional Data is passed to Anura using JSON encoded array strings. The following example illustrates how to build a simple JSON encoded array string using PHP.

Data Array

PHP
<?php
// create an array of data
$data = array(
    1 => "9868061c",
    2 => "a4ab95",
    5 => "d021ed96d184"
);
// output the json encoded array string
echo json_encode($data);
?>

The following string, from the output of the PHP code above, is an example of the JSON encoded array string that should be submitted to Anura using the additional parameter.

JSON Encoded Array String

{"1":"9868061c","2":"a4ab95","5":"d021ed96d184"}

Array Values

Data array values may only be strings or numbers of less than or equal to 128 characters. Values greater than 128 characters will be ignored and will not be stored.

Array Keys

It is important to declare the keys in your data array as numbers, starting with 1 and incrementing until your instance's Additional Data limit, so that your data points can be mapped to an Additional Data Definition, or self-mapped label, from within the Anura Dashboard. Once created, Additional Data Definitions are inserted into the column headers of Raw Data Reports containing Additional Data. It is also important to pass points of Additional Data using the same key position across requests for Raw Data report consistency.

Additional Data Definitions

The Anura Dashboard provides a method of declaring self-mapped labels for your Additional Data array keys, allowing you to have descriptive column headers when viewing your data in a Raw Data Report. The following string illustrates a mapping of Additional Data array keys from our examples used above.

{"Offer ID":"9868061c","Transaction ID":"a4ab95","Click ID":"d021ed96d184"}

When using our "one line" Script implementation, or Direct GET requests, be sure to URL encode your JSON encoded array string so it is passed to Anura correctly.

Additional Data Definitions are not required when viewing Additional Data. A default value of Additional Data XX will be returned when no key definition has been defined.

Every Anura instance comes with 10 available points of additional data. However, if you require more than 10 points of additional data, the default limit can be raised. Contact your Anura Account Executive for more information.

We recommend you do not send personally identifiable information when using Additional Data.

Callback Functions

Developing applications is not one size fits all. Therefore, we're providing a few JavaScript-based examples that will attempt to demonstrate when data is available and the various ways you can interact with the callback and response object functions to obtain data and make decisions within the context of your applications.

Be sure to apply your own programming logic and remove all unnecessary console logging before putting your code into a production environment!

We know not everyone is a developer, therefore, we've created a wizard where you're able to create your own semi-custom integrations! You can find it under the "Integration" tab in the Anura Dashboard or by going directly to the Anura Integration Wizard.

Request

We've already covered adding Anura Script to your application, but to reiterate, begin by adding Anura Script to the end of your page's <head> tag to create a request and generate a result.

JavaScript
<script type="text/javascript">
// FOR DEMONSTRATION PURPOSES ONLY!
(function(){
    var anura = document.createElement('script');
    if ('object' === typeof anura) {
        var request = {
            instance: 123456789,
            callback: 'anuraResponseCallback'
        };
        var params = [Math.floor(1E12*Math.random()+1)];
        for (var x in request) params.push(x+'='+encodeURIComponent(request[x]));
        anura.type = 'text/javascript';
        anura.async = true;
        anura.src = 'https://script.anura.io/request.js?'+params.join('&');
        var script = document.getElementsByTagName('script')[0];
        script.parentNode.insertBefore(anura, script);
    }
})();
</script>

The JavaScript example shown above makes use of a hypothetical callback function named 'anuraResponseCallback' which is required for accessing Anura Script's response data in our latter examples.

The callback parameter must be defined and accessible from the (global scope) window object to execute your custom callback function.

The callback parameter does not need to be defined when performing basic monitoring or when a callback function is not going to be used.

Response

The callback function is executed at the completion of the "Request. Response." process. Each successful response from Anura Script will include either an Anura assigned response ID or your unique, self-provided EXID. The response ID, or EXID, is then used to query the result from Anura's servers.

1. Response Only Callback

The most secure way to obtain result data from Anura is by performing result queries from a back-end server, which limits exposure of potentially sensitive data to the client. The response ID, or the self-provided EXID, are accessible by using the built-in getId() and getExId() response object functions respectively.

JavaScript
<script type="text/javascript">
// FOR DEMONSTRATION PURPOSES ONLY! DO NOT CONSOLE LOG IN PRODUCTION ENVIRONMENTS!
function anuraResponseCallback() {
    if (!!Anura) {
        // currently executing
        console.log(arguments.callee.name);
        // response object functions
        console.log('ID = ' + Anura.getAnura().getId());
        console.log('EXID = ' + Anura.getAnura().getExId());
        console.log('HAS RESULT = ' + Anura.getAnura().hasResult());
        console.log('ERROR = ' + Anura.getAnura().getError());
        // response object values
        console.log(Anura.getAnura().getResponseObject());
    }
}
</script>

The response ID, or EXID, is the only value returned when "full response" is disabled.

2. Response and Query Result Callback

Not everyone is able to perform result queries from a back-end server, which is why we've included the ability as a built-in function. However, be aware and understand that querying result values directly from a client-side environment is less secure and introduces potential risk, as modern web browsers can record and display information about network requests taking place in the background.

Expanding on our previous example, to query result data from the client-side, we would use the queryResult(callback) function. The callback parameter is used to execute a referenced callback function at the completion of the result query.

JavaScript
<script type="text/javascript">
// FOR DEMONSTRATION PURPOSES ONLY! DO NOT CONSOLE LOG IN PRODUCTION ENVIRONMENTS!
function anuraResponseCallback() {
    if (!!Anura) {
        // currently executing
        console.log(arguments.callee.name);
        // response object functions
        console.log('ID = ' + Anura.getAnura().getId());
        console.log('EXID = ' + Anura.getAnura().getExId());
        console.log('HAS RESULT = ' + Anura.getAnura().hasResult());
        console.log('ERROR = ' + Anura.getAnura().getError());
        // response object values
        console.log(Anura.getAnura().getResponseObject());
        // result callback
        function anuraResultCallback() {
            // currently executing
            console.log(arguments.callee.name);
            // result object functions
            console.log('HAS RESULT = ' + Anura.getAnura().hasResult());
            console.log('IS GOOD = ' + Anura.getAnura().isGood());
            console.log('IS WARNING = ' + Anura.getAnura().isWarning());
            console.log('IS BAD = ' + Anura.getAnura().isBad());
            console.log('RESULT = ' + Anura.getAnura().getResult());
            console.log('RULE SETS = ' + Anura.getAnura().getRuleSets());
            console.log('INVALID TRAFFIC TYPE = ' + Anura.getAnura().getInvalidTrafficType());
            console.log('IS MOBILE = ' + Anura.getAnura().isMobile());
            console.log('MOBILE = ' + Anura.getAnura().getMobile());
            console.log('HAS ADBLOCKER = ' + Anura.getAnura().hasAdBlocker());
            console.log('ADBLOCKER = ' + Anura.getAnura().getAdBlocker());
            console.log('ERROR = ' + Anura.getAnura().getError());
            // result object values
            console.log(Anura.getAnura().getResultObject());
        }
        // execute result query and callback
        Anura.getAnura().queryResult(anuraResultCallback);
    }
}
</script>

The response ID, or EXID, is automatically referenced from response data and does not need to be declared.

3. Response and Query Result Callback with Custom Variable

For your convenience, Anura Script offers the ability to declare a custom (global scope) window variable that response object functions will be assigned to. The variable can be static or dynamic depending on your needs. To illustrate, we've modified the previous example to use a custom variable named 'controller'. Notice how both examples are similar in structure, however, the former piece of JavaScript uses a variable named 'Anura', while the latter uses 'controller' for its assignment.

JavaScript
<script type="text/javascript">
// FOR DEMONSTRATION PURPOSES ONLY! DO NOT CONSOLE LOG IN PRODUCTION ENVIRONMENTS!
function anuraResponseCallback() {
    if (!!controller) {
        // currently executing
        console.log(arguments.callee.name);
        // response object functions
        console.log('ID = ' + controller.getAnura().getId());
        console.log('EXID = ' + controller.getAnura().getExId());
        console.log('HAS RESULT = ' + controller.getAnura().hasResult());
        console.log('ERROR = ' + controller.getAnura().getError());
        // response object values
        console.log(controller.getAnura().getResponseObject());
        // result callback
        function anuraResultCallback() {
            // currently executing
            console.log(arguments.callee.name);
            // result object functions
            console.log('HAS RESULT = ' + controller.getAnura().hasResult());
            console.log('IS GOOD = ' + controller.getAnura().isGood());
            console.log('IS WARNING = ' + controller.getAnura().isWarning());
            console.log('IS BAD = ' + controller.getAnura().isBad());
            console.log('RESULT = ' + controller.getAnura().getResult());
            console.log('RULE SETS = ' + controller.getAnura().getRuleSets());
            console.log('INVALID TRAFFIC TYPE = ' + controller.getAnura().getInvalidTrafficType());
            console.log('IS MOBILE = ' + controller.getAnura().isMobile());
            console.log('MOBILE = ' + controller.getAnura().getMobile());
            console.log('HAS ADBLOCKER = ' + controller.getAnura().hasAdBlocker());
            console.log('ADBLOCKER = ' + controller.getAnura().getAdBlocker());
            console.log('ERROR = ' + controller.getAnura().getError());
            // result object values
            console.log(controller.getAnura().getResultObject());
        }
        // execute result query and callback
        controller.getAnura().queryResult(anuraResultCallback);
    }
}
</script>

The variable parameter is defined in the initial Anura Script request. Refer to our Script Integration - Request documentation for further details.

4. Response and Query Result Callback with Return Arguments and Anonymous Function

If you're unable to interact with the (global scope) window variable, Anura Script does return a response object as the first argument for both response callback and queryResult callback functions.

JavaScript
<script type="text/javascript">
// FOR DEMONSTRATION PURPOSES ONLY! DO NOT CONSOLE LOG IN PRODUCTION ENVIRONMENTS!
function anuraResponseCallback(response) { // the response object is returned
    // currently executing
    console.log(arguments.callee.name);
    // response object functions
    console.log('ID = ' + response.getId());
    console.log('EXID = ' + response.getExId());
    console.log('HAS RESULT = ' + response.hasResult());
    console.log('ERROR = ' + response.getError());
    // response object values
    console.log(response.getResponseObject());
    // execute result query and callback
    response.queryResult(function(result){ // the result callback can be passed anonymously with the response object returned
        // currently executing
        console.log(arguments.callee.name);
        // result object functions
        console.log('HAS RESULT = ' + result.hasResult());
        console.log('IS GOOD = ' + result.isGood());
        console.log('IS WARNING = ' + result.isWarning());
        console.log('IS BAD = ' + result.isBad());
        console.log('RESULT = ' + result.getResult());
        console.log('RULE SETS = ' + result.getRuleSets());
        console.log('INVALID TRAFFIC TYPE = ' + result.getInvalidTrafficType());
        console.log('IS MOBILE = ' + result.isMobile());
        console.log('MOBILE = ' + result.getMobile());
        console.log('HAS ADBLOCKER = ' + result.hasAdBlocker());
        console.log('ADBLOCKER = ' + result.getAdBlocker());
        console.log('ERROR = ' + result.getError());
        // result object values
        console.log(result.getResultObject());
    });
}
</script>

5. Full Response Callback

A "full response", which includes result data, is available to be returned with the response for immediate use. However, "full response" should only be used on occasions when you're unable to connect to the result endpoint.

JavaScript
<script type="text/javascript">
// FOR DEMONSTRATION PURPOSES ONLY! DO NOT CONSOLE LOG IN PRODUCTION ENVIRONMENTS!
function anuraResponseCallback() {
    if (!!Anura) {
        // currently executing
        console.log(arguments.callee.name);
        // response object functions
        console.log('ID = ' + Anura.getAnura().getId());
        console.log('EXID = ' + Anura.getAnura().getExId());
        console.log('HAS RESULT = ' + Anura.getAnura().hasResult());
        console.log('IS GOOD = ' + Anura.getAnura().isGood());
        console.log('IS WARNING = ' + Anura.getAnura().isWarning());
        console.log('IS BAD = ' + Anura.getAnura().isBad());
        console.log('RESULT = ' + Anura.getAnura().getResult());
        console.log('RULE SETS = ' + Anura.getAnura().getRuleSets());
        console.log('INVALID TRAFFIC TYPE = ' + Anura.getAnura().getInvalidTrafficType());
        console.log('IS MOBILE = ' + Anura.getAnura().isMobile());
        console.log('MOBILE = ' + Anura.getAnura().getMobile());
        console.log('HAS ADBLOCKER = ' + Anura.getAnura().hasAdBlocker());
        console.log('ADBLOCKER = ' + Anura.getAnura().getAdBlocker());
        console.log('ERROR = ' + Anura.getAnura().getError());
        // response object values
        console.log(Anura.getAnura().getResponseObject());
    }
}
</script>

Talk to support about whether enabling "full response" is right for you.