Anura Docs

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.