Global API
Overview
After you have successfully installed the Black Crow AI script on your page, you can use the Black Crow Global API to (a) ingest scores in any target platform for which we don't already have a turnkey integration, or (b) asynchronously send page data to Black Crow AI after page load.
Setup
(1) Ingest Scores in a Target Platform
Note: Please ask your Customer Success Manager (CSM) to enable this feature before proceeding.
Once your CSM has confirmed that audience scoring has been activated, add the below script to all pages where you wish to ingest scores. The script exposes all Black Crow AI scores generated in a callback function where you can invoke the target platform API's of your choosing. Our integrations team can help you build a custom integration using the Global API if assistance is needed.
<script>
// INGEST BLACK CROW SCORES
window.blackcrow = window.blackcrow || [];
var blackCrowScoresUpdateBinding = {
app_name: 'audience',
bind: 'scores_update',
callback: scoresUpdateHandler,
timeout: setTimeout(function() {
blackCrowScoresUpdateBinding.timeoutReached = true;
// handle failure state as desired
scoresUpdateHandler('err');
}, 3000)};
window.blackcrow.push(blackCrowScoresUpdateBinding);
function scoresUpdateHandler(scoreObj) {
console.log(scoreObj);
}
</script>
(2) Send async page data to Black Crow AI.
Not all data is available on page load. As this data becomes available, you can execute the following script to ensure the data is consumed by Black Crow AI.
<script>
// EXTEND BLACK CROW DATA LAYER
window.blackcrow = window.blackcrow || [];
window.blackcrow.push({
trigger: 'extend',
data: {
foo: true, // add data fields here
},
});
</script>