The context request object

Use a context object to specify the types of context you want to retrieve in the response. You can add different <context_types> in your request, such as information about the user, browser, geographic location, store, fitment, page, campaign, and channel to make results more relevant.

The following shows the basic structure of a context object in a request:

{
    "context": {
	"<context_type>": {
            "<context_key>": {<context_key_values>}
	}
    }
}

Key

The following table describes the keys that the context object contains:

KeyTypeDescriptionValues
context_typeContext type objectOptional.Contains the supported context object type.You can have more than one context_type.channelcampaignpagefitmentstoregeobrowseruser
context_keyarrayOptional.Contains the <context_key_values> that correspond to the fields in each context object type.You can have more than one context_key.n/a

Context type objects

The following table describes the supported context objects:

ObjectTypeDescription
userUser context objectUser details including IDs, gender, email address, and group.
browserBrowser context objectUser device or browser information.
geoGeo context objectUser location including geographic information and IP address.
storeStore context objectStore ID associated with the user.
fitmentFitment context objectUser fitment information.
pagePage context objectPage details including URL, title, IDs, list of products, and locale information.
campaignCampaign context objectCampaign information including utm_source and utm_campaign.
channelChannel context objectChannel information.

Example

In this example, you apply a user context for gender:

}

{
  "query": {
    "keyphrase": [["red", "shorts"]]
  },
  "n_item": 3,,
  "content": {},
  "context": {
    "user": {
      "gender": "female"
    }
  }
If you have suggestions for improving this article, let us know!