How to Integrate Anura with Retreaver

Preventing Ad-Fraud by using Anura on your landing pages

Anura provides an easy-to-use platform designed to help you analyze and verify online interactions with your brand in real-time. Combined with the call filtering and routing tools provided by Retreaver, Anura can analyze and score online leads for authenticity prior to being processed by your call campaign network.

In other words, if fraudulent or bad traffic reaches your website and attempts to dial a Retreaver number, Retreaver will block the call before it reaches the endpoint if it is deemed to be bad traffic by Anura.

View our Anura integration announcement to learn more about the benefits of utilizing Anura's anti ad-fraud platform.



Integrating with Anura Walkthrough

The following guide will assist web developers looking to integrate Anura into their web assets alongside the Retreaver's Real-Time Tracking script.

Feel free to contact Retreaver Support if you require assistance setting up Anura for your web assets. 

Step 1) Generate an Anura "Instance Id".

Create an Account with Anura and navigate through their platform to access your Instance ID. The Instance ID will act as an API key which will be used to access the Anura script in later steps.


You can access your Instance Id by heading to Account->Instances from the left side bar on the Anura platform. 

Step 2) Including Retreaver Real-Time Tracking on your web assets.

In order to process incoming traffic through Anura and back to Retreaver, you must first implement Real Time Tracking on your web asset. This will allow Retreaver to automatically validate the lead through Anura and tag the results back to the leads supplied caller ID.

Step 3) Including the Anura script on your web assets.

Once you have implemented Real-Time tracking on your web asset, you may begin adding the required Anura scripts.

For the follow steps in this guide, we will be walking you through the information provided on the Anura integration docs. Feel free to reference the Anura documentation for a more in-depth look behind the process if desired.

Add the Anura script and any subsequent functions above the Retreaver Script as follows:

    <script type=“text/javascript”>
var anura = document.createElement(‘script’);
if (‘object’ === typeof anura) {
var request = {
callback: ‘optionalCallbackFunction’
var params = [];
for (var x in request) params.push(x+‘=’+encodeURIComponent(request[x]));
anura.type = ‘text/javascript’;
anura.async = true;
anura.src = ’'+params.join('&');
var script = document.getElementsByTagName(‘script’)[0];
script.parentNode.insertBefore(anura, script);

This script will add the core Anura functionality to your web asset using the Instance ID you referenced from Step 1 earlier.

Note the callback: ‘optionalCallbackFunction’ line - this will be the name of a function we will create to process the response back from Anura in the next step.

Step 4) Including the Anura callback to process the response. 

Directly below the Anura script add the supporting call back methods used to receive and extract the Anura lead analysis response as follows:

    <script type=“text/javascript”>
function optionalCallbackFunction(response) {
if (response.getId() || response.getExId()) {
function getResult(response) {
var method = ‘POST’;
var params = [‘instance=2607321773’];
if (response.getId()) params.push(‘id=’+encodeURIComponent(response.getId()));
if (response.getExId()) params.push(‘exid=’+encodeURIComponent(response.getExId()));
var url = ‘'+('GET’ === method ? ‘?’+params.join(‘&’): ‘’);
// internet explorer 8-9
if (window.XDomainRequest) {
var http = new XDomainRequest();
if (http) {, document.location.protocol === ‘https:’ ? url: url.replace(‘https:’, ‘http:’));
http.onprogress = function(){}
http.ontimeout = function(){}
http.onerror = function(){}
http.onload = function(){anuraResultHandler(this);}
setTimeout(function(){http.send(‘POST’ === method ? params.join(‘&’): ‘’);}, 0);
// other browsers
} else if (window.XMLHttpRequest) {
var http = new XMLHttpRequest();
if (http && ‘withCredentials’ in http) {, url, true);
if (‘POST’ === method) http.setRequestHeader(‘Content-type’, ‘application/x-www-form-urlencoded’);
http.onload = function(){anuraResultHandler(this);}
http.send(‘POST’ === method ? params.join(‘&’): ‘’);
function anuraResultHandler(http) {
console.log( ‘Anura HTTP Response Text: ’ + http.response);
console.log( ‘JSON.parse(http.response).result: ’ + JSON.parse(http.response).result );

Note the "anuratextresponse" and "anuratextresponsecode" form fields on the last two lines. These are invisible form fields you will be creating on your form which will be auto-populated as soon as a response from Anura is received upon a page load.

Step 5) Storing the Anura response in invisible form fields on your page.

The next step is to store the Anura response that was extracted in step 4. We can achieve this by creating two invisible form fields on your page that will be filled by the Anura callback function as soon as the page loads.

Once the lead fills out and submits the form, the Anura response and response code will be packaged into the form and can then be used to trigger a Retreaver Click-To-Call or trigger a webhook postback submission back to Retreaver.

Create two hidden fields on your form:
1) anuratextresponse, with a name value of "anuratextresponse".
2) anuratextresponsecode, with a name value of "anuratextresponsecode".

At this point, Anura is automatically analyzing all incoming traffic to your site and storing the results into two invisible form fields on your page

Step 6) Passing the Anura response back to Retreaver using Real-time tracking.

You will now need to modify the Retreaver Real-Time Tracking script on your page to include your two newly created Anura form fields so that it can be packaged along with the rest of your form values on a form submit.

Modify your "updateTags()" function  to include your two new Anura fields as follows:


Here we are extracting the value of the invisible Anura form fields, and adding them to the "number.replace_tags" function below your other form field values. This will tag the supplied caller ID with all of your form values including the Anura response.

Similarly, if you are using Click-To-Call on your page, modify the click to call initiation function as well to extract and include your Anura fields. This will tag the supplied caller ID with all of your form values including the Anura response once a click-to-call request has been initiated:


As of this point, all leads that load your web asset will be analyzed by Anura, and the resulting response will be tagged to the supplied Caller ID using "anura_response" and "anura_code" as the tag key identifiers.

Step 7) Creating Anura Tags.

Head into your Retreaver account and navigate to the tags page, then click "+ New Tag".

Create two new text tags with a key value of "anura_response" and "anura_code".

Disable prompts for both of these tags and apply a cyan color using the following HEX value: "#03E6FF" to complete your Anura tags.

The Anura tags will look like the screenshot below and will be visible on any call flow page where Anura is presently used:


The "anura_code" tag specifies whether or not the lead was authentic, and the "anura_response" tag contains various information regarding the authenticity of the lead including the device and any existing browser extensions the lead is using.

Visit the Anura documentation for more information regarding these response codes.

Step 8) Utilizing the Anura response to influence routing or webhook actions.

In order to utilize the Anura tags and influence routing behavior inside of your Retreaver campaigns, head into your listed buyer/endpoint profiles and add the "anura_code" tag using the Tag wizard like so:


This instructs Retreaver to only route calls to this endpoint if the "anura_code" response was "good":


Your call campaigns are now protected from fraudulent, non-authentic traffic that would have otherwise sapped your advertising and affiliate budget.

0 out of 0 found this helpful



Please sign in to leave a comment.