0

I have created a function to feed data in real time to personalize which for now sends user id, item id, timestamp and event type. The problem is that all the event types are click. So now I want to send number of clicks too. Do I need to change the schema in personalize to accomodate number of clicks too? Also how would personalize know if more number of clicks means to show that item more?

For now my schema looks something like this -

{
    "type": "record",
    "name": "Interactions",
    "namespace": "com.amazonaws.personalize.schema",
    "fields": [
        {
            "name": "USER_ID",
            "type": "string"
        },
        {
            "name": "ITEM_ID",
            "type": "string"
        },
        {
            "name": "TIMESTAMP",
            "type": "long"
        },
        {
            "name": "EVENT_TYPE",
            "type": "string"
        }
    ],
    "version": "1.0"
}

and this is the function to feed data into personalize.

const streamInteractions = async (req, res) => {
    const { eventType, userId, trackingId, clicks } = req.body;
        var eventDate = new Date();
        var putEventsParams= {
            'sessionId': '1', 
            'trackingId': trackingId,
            'userId': userId,
            eventList: [
                {
                  'eventType': eventType, 
                  'sentAt': eventDate
                  'properties': '{number_of_clicks: clicks}' //is this the correct way to send the number of clicks?
                },
            ]
        }
        personalizeevents.putEvents(putEventsParams, function (err, data) {
          if (err) {
                console.log(err, err.stack);
          }
          else{     
                console.log(data);
          }
        });
    res.json('Done!');
}

1 Answers1

0

Each click should be sent to Personalize as a separate event where the timestamp represents when each click occurred. You currently cannot aggregate events into a single event or weigh one event type or interaction more than another. Since Personalize uses sequence models to understand user intent across sessions, the order of interactions is what is important.

James J
  • 621
  • 3
  • 6