API Reference / API Parameters / userToken
Feb. 26, 2019
Type: string
Engine default: user ip address
Parameter syntax
userToken => 'YourCustomUserId'

Can be used in these methods:

About this parameter

Associates a certain user token with the current search.

Sending a user token will associate a search with a certain user. The insights taken from this could be used in combination with personalization for example. The user token has to be an alpha-numeric string with a maximum amount of 64 characters.

Examples

Set the user token

1
$index->search('query', ['userToken' => '123456'])

Enable personalization for the current search and specify a user token

1
2
3
4
$index->search('query', [
  'enablePersonalization' => true,
  'userToken' => '123456'
]);

Did you find this page helpful?