Skip to main content

Consume Recommendations

By default, new campaigns are configured to track recommendations from every invokation. In some situations however, you may wish to preload a recommendation, and only track the recommendation when shown to the Customer.

Configuration Required

Your campaign must be set to require consumption events for this learning behaviour to be enforced. This can be toggled in the campaign's Settings options.

These situations may include:

  • Preloading a recommendation in a browser application to minimise latency
  • Preloading a recommendation into a custom CRM, but not necessarily acting on the recommendation.

Generate a recommendation consumption event

Helpder syntax events.createRecommendationConsumedEventAsync() was introduced in version 1.4.5

import { events } from "cherry.ai";
const ACCESS_TOKEN = "your access token";

// the recommendation comes from invoking the campaign
await events
.createRecommendationConsumedEventAsync({
token: ACCESS_TOKEN,
commonUserId: recommendation.commonUserId,
correlatorId: recommendation.correlatorId,
});