Api clients / Ruby / V1 / Methods

Add Strategy | Ruby API Client V1 (Deprecated)

This version of the Ruby API client has been deprecated in favor of the latest version of the Ruby API client.

Required API Key: any key with the editSettings ACL
Method signature
client.set_personalization_strategy(Map strategy)

About this method

Set a personalization strategy.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$recommendation->setPersonalizationStrategy([
    'eventsScoring' => [
        [
            'eventName' => 'Add to cart',
            'eventType' => 'conversion',
            'score' => 50,
        ],
        [
            'eventName' => 'Purchase',
            'eventType' => 'conversion',
            'score' => 100,
        ],
    ],
    'facetsScoring' => [
        ['facetName' => 'brand', 'score' => 100],
        ['facetName' => 'categories', 'score' => 10],
    ],
    'personalizationImpact' => 50,
]);

Parameters

strategy
type: object
Required

A strategy object.

{
  "eventScoring": eventsScoring,
  "facetsScoring": facetsScoring
}

strategy

eventsScoring
type: object
Required

Associate a score to an event

1
2
3
4
5
6
{
  "${eventName}": {
    "score": int // mandatory
    "type": string // mandatory
  }
}
facetsScoring
type: object
Required

Associate a score to a facet.

1
2
3
4
5
  {
    "${facetName}": {
      "score": int // mandatory
    }
  }
requestOptions
type: key/value mapping
default: No request options
Optional

A mapping of request options to send along with the request.

Response

No response.

Did you find this page helpful?