Laravel Scout extended - send event with correct ObjectId

Hello All,

I’m currently using algolia scout extended extension (and laravel scout), i’m trying to send event and enable personalization for my users but i’m facing some issues, here is the code i’m using to send event:


$insights->user((string)\Auth::user()->getKey())->convertedObjectIDs(
     'user_favorite_on_search_page',
     'user',
      ['App\Models\User::'.(string)$user_search->getScoutKey()]
);

The problem is that i can see in the Algolia Dashboard that the ObjectId for an item is for example App\Models\User::100 but in the Insight API Log I’ve this:

{
  "eventType": "conversion",
  "eventName": "user_favorite_on_search_page",
  "index": "users",
  "objectIDs": [
    "App\\Models\\User:100
  ],
  "userToken": "1"
}

Is that normal that i’ve multiple \\ or is it a rendering issue?
How can i make sure that the event is correctly linked to an object?

Thanks for your help
Christophe

The snippet you’ve posted is a JSON dump of the event body.

JSON.stringify prints the string so that it can be re-revaluated by JSON.parse, so that JSON.parse(JSON.stringify(foo)) is equal to foo.

If you open your browser console and try running this code, you’ll see that it prints the same \\:

console.log(JSON.stringify({ object: "abc \\n def" }));
// Output: {"object":"abc \\n def"}

If it didn’t, a follow-up JSON.parse would recognize \n as an escape sequence which adds a newline, which is not what this object contains.
\\ is itself an escape sequence which means \.

As to validate whether or not your implementation works: I believe all your objects have this objectID pattern, so it should be an all or nothing scenario: if it works for some, it must work for all.
As a result, you should be able to check this in the Analytics tab of your Dashboard: if the Top results card is populated, then it means it worked as expected.