Integration with Adobe Analytics

Overview

This document provides a basic integration guide for using HUMAN’s binary result flag to enrich Adobe Analytics.

Requirements

Getting Started

Enable Score Reporting

In the HUMAN Portal navigate to Product Settings -> Data & Configuration -> Score Reporting and select the policy associated with your defined application. Then, toggle the Score Reporting button to Enabled and select the Binary radio button. Set the threshold score to 100.

Javascript Integration

The binary result from HUMAN evaluation will be returned as an event. In order to receive the event the following function must be created and the result will be stored in an Adobe eVar.

Code Sample

window.APPID_asyncInit = function(px) {
   px.Events.on('score', function(score) {
     // Set your action for the score here
     // The score can go to another variable or function
     try {
       // Set eVar for Adobe
       window.digitalData.page.pageInfo.attributes.pxbs = score;
     } catch (err) {
       console.log("error: " + err);
     }
   });
};

📘

Note

APPID will be equal to your app ID. For example if your APPID is PX12345678 then your function variable will be window.PX12345678_asyncInit

Adding the JS to Your Page

The Javascript integration can be added to your existing HUMAN Javascript snippet.

<script type="text/javascript">
(function() {

    // Adobe Integration added here
  window.PX12345678_asyncInit = function(px) {
    px.Events.on('score', function(score) {
      // Set your action for the score here
      // The score can go to another variable or function
      try {
        // Set eVar for Adobe
        window.digitalData.page.pageInfo.attributes.pxbs = score;
      } catch (err) {
        console.log("error: " + err);
      }
    });
  };
// Custom parameters
// window._pxParam1 = "<param1>";
var p = document.getElementsByTagName('script')[0],
  s = document.createElement('script');
s.async = 1;
s.src = '//client.perimeterx.net/PX12345678/main.min.js';
p.parentNode.insertBefore(s, p);
}());
</script>

Enable Data enrichment Reporting

Data enrichment cookie: read more
To handle data enrichment on the client side, you can use the enrich event:

px.Events.on('enrich', function (value) {
  // value - the enriched data, in the form of <HMAC>:<Base64 encoded data>
  const base64Data = value.split(":")[1]; // split value to get the base64 encoded data
  const dataStr = atob(base64Data); // base64 decode the enrichment data
  const data = JSON.parse(dataStr); // get the data as JSON
  window.digitalData.page.pageInfo.attributes.pxfId = data['f_id']; // get f_id data
  console.log('DATA', data);
});