Recording events for anonymous users - Amazon Personalize
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Recording events for anonymous users

Important

If you don't record at minimum one event with a sessionId and userId for a user, Amazon Personalize won't use the activity tracked to only the sessionId when training. And after training completes, recommendations will no longer be based on activity tracked to the sessionId.

You can record item interaction or action interaction events for users before they create an account. Record events for anonymous users to build a continuous event history with events from before and after they log in. This provides Amazon Personalize more interactions data about the user, which can help generate more relevant recommendations.

To record events for anonymous users (users that haven't logged in), for each event specify only a sessionId. Your application generates a unique sessionId when a user first visits your website or uses your application. You must use the same sessionId in all events throughout the session. Amazon Personalize uses the sessionId to associate events with the user before they log in.

Amazon Personalize doesn't use events from anonymous users when training until you associate them with a userId. For more information, see Building a continuous event history for anonymous users.

To provide real-time personalization for anonymous users, specify the sessionId as the userId in your GetRecommendations or GetActionRecommendations request.

Building a continuous event history for anonymous users

To build an event history for an anonymous user and have Amazon Personalize use their events when training, record at minimum one event with both a sessionId and a userId. Then you can record any number of events for the userId. After you start providing a userId, the sessionId can change. During the next full retraining, Amazon Personalize associates the userId with the anonymous user history tracked to the original sessionId.

After retraining completes, recommendations will be based on activity tracked to both the sessionId from the anonymous events and any events tracked to their userId.

Note

If your user doesn't create an account and you want Amazon Personalize to use the data when training, you can use the sessionId as the userId in events. However, if the user eventually creates an account, you won't be able to associate the events from their anonymous browsing with their new userId.