For our standard JavaScript integration, we identify a user across pageviews using first-party user identifier cookies stored under the website's domain, as described at Cookies and Local Storage for more information). Unfortunately, this solution does not work to identify users across sites. If you are interested in cross-site recommendations (showing recommendations from one of your websites to users on another) then our first-party cookie system is insufficient.
Note that if you are running fetch multiple times in a page (for both within-site and cross-site recommendations) you may want to enable multiFetch as described in the $p("init") documentation.
Cross-site recommendations by JavaScript key
If you have multiple domains, each with a separate JavaScript key, you can request cross-site recommendations by specifying a JavaScript key in the opts, both when you register and when you track. For instance, the following is a quick test to see that you can return LiftIgniter recommendations on your website.
// Register call to get 100 recommendations for widget 'default-widget'.
// Apply a simple callback to print out the JSON response.
$p('register', {
max: 100, // Large number requested so you can see our full range of items
widget: 'default-widget', // name of widget
opts: {jsk: "vba4vdhq7eo382ub"},
callback: function(resp) {
console.log(JSON.stringify(resp, null, 2));
}
});
// Execute the registered call.
$p('fetch');
And the following is the skeleton for implementing registering, rendering, and tracking functionality for LiftIgniter recommendations on your site. Basically, you'll follow the same process to render and track recommendations as described in the "Model query (Javascript)" section of our documentation, but you must include the jsk in the opts for register and track.
// Register call to get 100 recommendations for widget 'default-widget'.
// Apply a simple callback to print out the JSON response.
$p('register', {
max: 100, // Large number requested so you can see our full range of items
widget: 'default-widget', // name of widget
opts: {jsk: "vba4vdhq7eo382u"},
callback: function(resp) {
console.log(JSON.stringify(resp, null, 2));
console.log("// TEST.");
// In order to launch recs in production, please reference the documentations on Rendering Widgets and Tracking Widgets:
// $p('render', ...)
$p("track", {
elements: ...
...,
opts: {jsk: "vba4vdhq7eo382u"},
})
}
});
// Execute the registered call.
$p('fetch');
Receiving ML-trained cross-site recommendations requires activation by LiftIgniter
Please be in touch with the LiftIgniter team at [email protected] in order to be have this feature activated. In order to protect customer separation, as well as for quality control purposes, we activate cross-site model training between properties only upon customer request. Without requesting us, you will receive a mostly static list of popular recommendations rather than context-specific or user-specific recommendations.
Cross-site recommendations from backend
If you are using Model Queries from Backend (i.e., sending the model query from the backend), then for cross-site recommendations, you need to make sure of the following:
- The API key you use should be of the property for which you want recommendations.
- The
url
orid
field that you include should be from the original property. - Please include the
gid
field as instructed at Model Queries from Backend.