External Management

To manage two or more instances of the Backstage without losing information about search clicks, you can send external clicks from one instance to another.

Typically, you would have one search input and results from different Backstage instances.

Example: This is how you show two results components linked to a single search box:

//SDK creation
var sdkA = InbentaKmSDK.createFromDomainKey("Domain_Key_instance_a","API_Key_instance_a");
var sdkB = InbentaKmSDK.createFromDomainKey("Domain_Key_instance_b","API_Key_instance_b");

//Searchbox creation
var searchBox = sdkA.component('searchBox', '#search-box'); //sdk of the searchBox is not important

//Results creation
var resultsA = sdkA.component('results', '#resultsA');
resultsA.linkToSearchBox(searchBox);
var resultsB = sdkB.component('results', '#resultsB');
resultsB.linkToSearchBox(searchBox);

//Manage click in instance A to send external click to instance B
resultsA.$on('expand', function(content){
    sdkB.client.track('external_click',{externalCode:content.tracking.externalCode,searchCode:resultsB.getSearchCode()});
});

//Manage click in instance B to send external click to instance A
resultsB.$on('expand', function(content){
    sdkA.client.track('external_click',{externalCode:content.tracking.externalCode,searchCode:resultsA.getSearchCode()});
});

Important: You should configure an external type inside the main instance to track the external click. The external type should be the name of the external instance, written in uppercase (So in the example above, if the external instance is instance_b, the external type will be INSTANCE_B).