Define the personalization strategy

Creates a new personalization strategy.

Usage

Required ACL: recommendation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import "github.com/algolia/algoliasearch-client-go/v4/algolia/personalization"

client, err := personalization.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", personalization.US)
if err != nil {
  // The client can fail to initialize if you pass an invalid parameter.
  panic(err)
}

response, err := client.SetPersonalizationStrategy(client.NewApiSetPersonalizationStrategyRequest(

  personalization.NewEmptyPersonalizationStrategyParams().SetEventScoring(
    []personalization.EventScoring{*personalization.NewEmptyEventScoring().SetScore(42).SetEventName("Algolia").SetEventType(personalization.EventType("click"))}).SetFacetScoring(
    []personalization.FacetScoring{*personalization.NewEmptyFacetScoring().SetScore(42).SetFacetName("Event")}).SetPersonalizationImpact(42),
))
if err != nil {
  // handle the eventual error
  panic(err)
}
Did you find this page helpful?
Go API clients v4