Analytics & Reports
Analytics
StoreFront

Personalization in SAYT

As part of your SAYT implementation you may want to integrate the search signal from the Recommendations API.

Business Goal: I want to show searches that are currently trending to respond to my customer’s shifting tastes.

This can be done in 2 ways:

We can apply a filter so that the suggested trending searches use the SAYT keyword context - in other words:

Given that I have the intent of coffee, show me trending searches that contain coffee.

When the action of clicking into the textbox is detected, we can suggest generally trending searches in their area to cue their behavior.

When I’m not sure what I am looking for, suggest some searches for me.

Trending contextual searches

These trending searches can be driven by search terms, and the geography of the customer, to show the different searches for different locations.

For example for the entered search of shovel, East Coast maybe looking for snow shovel, where as the South may be looking for sand shovel.

This means there are 2 factors we’ll be using to filter:

  1. Driven by what was typed in
  2. Driven by the customer’s location

Sample Query

We will use the sample state (region) of New York, and search term shovel:

curl -H "Authorization: --clientKey--" \
    -XPOST "https://--customerId--.groupbycloud.com/wisdom/v2/recommendations/searches/_getPopular" \
    -d '{"matchPartial":{"and":[{"search":{"query":"shovel"}}]}, "matchExact":{"and":[{"visit":{"generated":{"geo":{"country":"us","region":"ny"}}}}]}}'

There are 2 parts, one for each portion of the business requirement:

  • matchPartial for the search, to execute a partial match on the terms entered
  • matchExact on the geography, to restrict the suggestions to the state

Sample response

This will return something like this:

json
{
  "status": {
    "code": 200,
    "message": "OK",
    "additionalInfo": null
  },
  "result": [
    {
      "query": "snow shovel",
      "count": 12
    },
    {
      "query": "stainless steel shovel",
      "count": 5
    }
  ],
  "serverTimestamp": "2017-02-1T12:00:00+00:00"
}

The front end can then show the result.query portion of the response within the SAYT box.

Trending Searches

If we wish to show generally trending searches, the same query and response apply, remove the matchPartial of the query so that our results are not restricted by a search term.

Sample Query

We will use the sample state (region) of New York:

curl
curl -H "Authorization: --clientKey--" \
    -XPOST "https://--customerId--.groupbycloud.com/wisdom/v2/recommendations/searches/_getPopular" \
    -d '{"matchExact":{"and":[{"visit":{"generated":{"geo":{"country":"us","region":"ny"}}}}]}}'

There is 1 part:

  • matchExact on the geography, to restrict the suggestions to the state

Sample Response

This will return something like this:

json
{
  "status": {
    "code": 200,
    "message": "OK",
    "additionalInfo": null
  },
  "result": [
    {
      "query": "salt",
      "count": 24
    },
    {
      "query": "snow shovel",
      "count": 12
    },
    {
      "query": "heater",
      "count": 9
    },
    {
      "query": "anti-freeze",
      "count": 6
    }
  ],
  "serverTimestamp": "2017-02-1T12:00:00+00:00"
}

The front end can then show the result.query portion of the response within the SAYT box.