Context
|
Type |
Class |
|
Import path |
|
Details about the site visitor's search request, such as locale, location, device, and web browser information. Sitecore Search uses this data for personalizing search results.
Constructor
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
Details about the site visitor's search request, such as locale, location, device, and web browser information. Sitecore Search uses this data for personalizing search results. |
Properties
|
Name |
Type |
Description |
|---|---|---|
|
|
The country and language the webpage is being viewed in. | |
|
|
The URI the site visitor came to the current webpage from. | |
|
|
Data about the site visitor. | |
|
|
Data about the online store where the site visitor made the search request. Typically used in Buy Online Pickup In Store retail strategies. | |
|
|
The UTM parameters in the URL of the webpage. | |
|
|
Geographical data about the search request. | |
|
|
Data about the site visitor's web browser. |
Accessors
The following properties are available to set:
get locale
Returns the locale data of the Context instance.
set locale
Sets the locale data of the Context instance.
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
The country and language the webpage is being viewed in. |
get page
Returns the page data of the Context instance.
set page
Sets the page data of the Context instance.
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
The URI the site visitor came to the current webpage from. |
get user
Returns the user data of the Context instance.
set user
Sets the user data of the Context instance.
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
Data about the site visitor. |
get store
Returns the store data of the Context instance.
set store
Sets the store data of the Context instance.
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
Data about the online store where the site visitor made the search request. Typically used in Buy Online Pickup In Store retail strategies. |
get campaign
Returns the campaign data of the Context instance.
set campaign
Sets the campaign data of the Context instance.
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
The UTM parameters in the URL of the webpage. |
get geo
Returns the geo data of the Context instance.
set geo
Sets the geo data of the Context instance.
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
Geographical data about the search request. |
get browser
Returns the browser data of the Context instance.
set browser
Sets the browser data of the Context instance.
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
Data about the site visitor's web browser. |
Methods
_validateContext
Validates the context object.
Signature
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
Required. Details about the site visitor's search request, such as locale, location, device, and web browser information. Sitecore Search uses this data for personalizing search results. |
Return value
Returns void.
Errors
_validateContextLocale
Validates the context locale object.
Signature
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
Optional. The country and language the webpage is being viewed in. |
Return value
Returns void.
Errors
_validateLocation
Validates latitude and longitude.
Signature
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
The geographical coordinates of the location where the site visitor made the search request. |
Return value
Returns void.
Errors
_validatePage
Validates the page object.
Signature
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
The URI the site visitor came to the current webpage from. |
Return value
Returns void.
Errors
_validateUser
Validates the user object.
Signature
Parameters
|
Name |
Type |
Description |
|---|---|---|
|
|
Optional. Data about the site visitor. |
Return value
Returns void.
Errors
removeLocale
Sets the locale data to undefined.
Signature
Return value
Returns void.
removePage
Sets the page data to undefined.
Signature
Return value
Returns void.
removeUser
Sets the user data to undefined.
Signature
Return value
Returns void.
removeStore
Sets the store data to undefined.
Signature
Return value
Returns void.
removeCampaign
Sets the campaign data to undefined.
Signature
Return value
Returns void.
removeGeo
Sets the geo data to undefined.
Signature
Return value
Returns void.
removeBrowser
Sets the browser data to undefined.
Signature
Return value
Returns void.
removeIds
Sets the ids data to undefined.
Signature
Return value
Returns void.
toDTO
Maps the Context instance to its DTO (data transfer object) format.
Signature
Return value
Returns the Context instance in a standardized DTO format.