Application Integration

Application integration usage

All our modules include a powerful feature that injects informational headers for each request.

These headers can be used inside any application by reading the HTTP request headers.
Below are a few examples for the most common coding languages:

if (!isset($_SERVER['HTTP_X_DATADOME_ISBOT'])) {
  
  // DataDome didn't handle this hit
  $isBot = 'na';

} else if ($_SERVER['HTTP_X_DATADOME_ISBOT'] == 1) {
  
  // The hit is coming from a bot
  $botName   = $_SERVER['HTTP_X_DATADOME_BOTNAME'];
  $botFamily = $_SERVER['HTTP_X_DATADOME_BOTFAMILY'];
  $isBot     = 'bot';

} else if ($_SERVER['HTTP_X_DATADOME_ISBOT'] == 0){ 
  
  // The hit is not coming from a bot
  $isBot     = 'human';

}

print 'Hit status: ' . $isBot;
if ($isBot === 'bot') {
  print '<br>' . $botName . '<br>' . $botFamily;
}
System.Net.Http.Headers.HttpRequestHeaders headers = this.Request.Headers;

string isBot = string.Empty;
string botName = string.Empty;
string botFamily = string.Empty;

if (!headers.Contains("X_DATADOME_ISBOT")){

    // DataDome didn't handle this hit
		isBot = "na";
  
} else if (headers.GetValues("X_DATADOME_ISBOT").First() == "1"){
  
  	// The hit is coming from a bot
		isBot = headers.GetValues("X_DATADOME_ISBOT").First();
		botName = headers.GetValues("X_DATADOME_BOTNAME").First();
		botFamily = headers.GetValues("X_DATADOME_BOTFAMILY").First();
  
}  else if (headers.GetValues("X_DATADOME_ISBOT").First() == "0"){
  
  	// The hit is not coming from a bot
		isBot = "human";
  
}

string str = "Hit status: " + isBot;
if (isBot == "bot") {
  str += " Bot Name: " + botName + " Bot Family: " + botFamily;
}
System.Console.WriteLine(str);
if (req.headers['X_DATADOME_ISBOT'] == undefined) {

  	// DataDome didn't handle this hit
  	isBot = "na"

} else if (req.headers['X_DATADOME_ISBOT'] == 1) {
 
  	// The hit is coming from a bot
    botName   = req.headers['X_DATADOME_BOTNAME'];
    botFamily = req.headers['X_DATADOME_BOTFAMILY'];
    isBot     = 'bot';

} else if (req.headers['X_DATADOME_ISBOT'] == 0) {

  	// The hit is not coming from a bot
 		isBot     = 'human';

}

str = "Hit status: " + isBot;
if (isBot == "bot") {
  str += " Bot Name: " + botName + " Bot Family: " + botFamily;
}
Console.log(str);