Additionally, please refer to our help pages for further useful information!
Due to performance optimization, the search function will calculate the total count up to 10,000. In this case the search page should display a count of 10,000+
to indicate that more than 10,000 products were found.
Filters and sorting operations are executed on all found products, even if there are more than this limit. Therefore, it's still possible to find other products if you filter or sort them. This should not affect the user experience in any way because it's unlikely that someone would actually view more than 10,000 products with a single search.
As soon as you use the results delivered by Nosto API, you will see that the listings in categories have a different order than listings delivered by your native shop-system, even if you didn't set up any merchandising rules. The products are mainly delivered as indexed during the data sync, but there is no defined behaviour for this. We recommend to always set up at least one global rule before going live with Nosto category merchandising to create product listings matching your business strategies.
Nosto provides functionality to retrieve all products for a specific category. This is useful when you want to implement category merchandising using the same API as for Search.
Using the category ID is only fully supported for Shopify merchants. Others should use the category path instead to benefit from full functionality.
Provide the API parameter to fetch all products associated with that category. Additionally should be provided for better analytics data.
Depending on your configuration, fetching a parent category will also include products from the child categories. For example, fetching products for the category Pants
would also include products from the categories Pants -> Shorts
and Pants -> Khakis
.
This is an admin-only setting. Please contact your Nosto representative to adjust this setting.
The category page shares a lot of similarities with the search page, so please refer to the search page documentation:
Not all of Nosto's functionality is available for pure GraphQL API integrations. The following features require :
Analytics
Segmentation
A/B testing
Debug toolbar
Both Search and Categories are built on the same technical foundation and use the same API and product data. For simplicity, we will just refer to Search API in the following documentation.
Use the to try out search queries and browse API reference.
It provides:
- you can see field types and inspect what fields are needed for a search request.
- you can see return field types with descriptions.
Send requests to the search engine and preview the response.
In the majority of cases, authentication is not a requirement for using search APIs. However in rare case may need to:
Access sensitive data- all sensitive data is restricted for public access (e.g. sorting by & returning sales).
Return all documents - public access require to specify search query, category ID or category path to avoid returning all documents.
Note: Keep your API key secret and do not expose it to the frontend!
Search use different API endpoint than other Nosto queries: https://search.nosto.com/v1/graphql
All requests require an account ID, which can be found in the top-right corner of the Admin dashboard, under the shop name.
Replace YOUR_ACCOUNT_ID
with your account id retrieved from the Nosto dashboard.
Replace YOUR_ACCOUNT_ID
with your account id retrieved from the Nosto dashboard.
Replace YOUR_ACCOUNT_ID
with your account id retrieved from the Nosto dashboard.
Replace YOUR_ACCOUNT_ID
with your account id retrieved from the Nosto dashboard.
Upon a successful request, the API will return a 200 status code response, which includes the search data:
API returns a list of errors with explanations. These errors should be logged internally and not displayed to the end user. Instead, display a general message, such as Search is unavailable at the moment, please try again
. This approach ensures that no sensitive information is leaked to the end user.
The API may return some errors even when data is returned. This means that some parts of the response may be missing, but you should still display the available data instead of showing an error to the user. These errors should be logged internally for future reference and troubleshooting.
For features like personalised results and user segments to function effectively, the search function needs access to the user's session information from the front-end.
To optimize search speed and reduce network load, select only the necessary data when performing a search query.
Variables should encompass all dynamic query data because it is the most efficient method to pass data, and data is automatically escaped to prevent injection attacks. Avoid generating dynamic queries, as they can lead to security issues if user input is not properly escaped.
Product fields that can be requested in the hits
object are documented . All indexed fields are accessible via the API.
Provide the API parameter to fetch all products associated with that category. This parameter is the same as the categories
product field.
Product fields that can be requested in the hits
object are documented . All indexed fields are accessible via the API.
In some rare cases or is not enough. In these cases can be used to build any query for category & landing pages.
To analyze user behavior you need to implement tracking. This can be achieved using our . You need to implement the following methods with type = category
:
to track category page visits
to track clicks on category results
with API_SEARCH
Role is available on dashboard settings page
When integrating Search you have the option to directly access the API, or you can use our existing that provides most of the required functionality out of the box.
JS API includes full-featured with tracking support.
It's possible to get search session data using the :
The results of this function should be passed to search query parameter. In case search is called from backend, it should pass this data to backend (e.g. using ).
It's also possible to save session data to on page load:
In the search application, you should use variables instead of hardcoded arguments to pass search data. This means that filters, sort, size, and 'from' options should be passed in the 'products' variable. For a full list of available options, please see the .
To analyze user behavior you need to implement tracking. This can be achieved using our . You need to implement the following methods:
to track search form submissions
Authorization
Bearer SEARCH_KEY
For a basic search, it’s enough to provide accountId
, query,
and select fields that should be returned. You can control which product attributes to select through products.hits
field. See all available fields.
For example, if you want to return only productId
and name
, the query would be:
accountId
Nosto account ID
query
search query text
See all query parameters.
Products offset parameter from
is used for pagination functionality.
The default count of documents returned per page is size = 5
, you can change it with products.size
, and offset of products is controlled with products.from
field:
By default results are sorted by products relevance score.
To change the sorting, use the sort parameter, where you would specify any indexed field which should be sorted by, and order: asc
for ascending and desc
for descending.
By default, you should always sort by relevance. Only if the user selects a different sort method, a sorting rule should be used.
Facets help the user to find products more easily. Faceted navigation is normally found in the sidebar of a website and contains filters only relevant to the current search query. Facets are configured in the Nosto dashboard.
To use facet for a specific field you need to configure it in the Nosto dashboard first.
One of the facet types is type = terms
. It returns list if common terms from found documents.
Assume that we have configured facets for customFields.brandname
and categories:
id
field
type
facet type, in this case terms
name
data.value
original facet value, it should be displayed in the user interface
data.count
shows how many products will be returned if you select this facet, it should be displayed in the user interface
data.selected
indicates if there is an active filter on this value
Stats facet returns minimum and maximum number field value from found documents. The most common usage is to render slider filter (e.g. price)/
name
terms
facet type, in this case stats
field
id
min
minimum field value for documents that match provided query
max
maximum field value for documents that match provided query
Filtering by terms
facet, for example by Adidas, Converse brands:
When filtering by multiple same field items, filters will be joined with OR operator and different fields with AND.
If you wish to have more facets, you should configure it in the Nosto dashboard first.
Filtering by stats
field, for example by price:
You can sort using these arguments: lt
(less than), gt
(greater than), lte
(less than or equal to), gte
(greater than or equal to).
Redirects can be used to forward users to special pages depending on their search keywords. For example, users searching for shipping
could be forwarded to https://example.com/shipping.html.
For API integrations GraphQL can only return the target URL. The actual browser redirect must be implemented by the merchant.
For features like personalised results and user segments to function effectively, the search function needs access to the user's session information from the front-end.
It's possible to get search session data using the JS API:
The results of this function should be passed to search query sessionParams parameter. In case search is called from backend, it should pass this data to backend (e.g. using form data).
To analyze user behavior you need to implement tracking. This can be achieved using our JavaScript library. You need to implement the following methods with type = serp
:
recordSearch to track search result interactions like filtering and pagination
recordSearchClick to track result clicks
Nosto Search engine is relevant out of the box and search API can be used without any initial setup. Nosto Dashboard can be used to further tune search engine configuration:
Searchable Fields - manage which fields are used for search and their priorities,
Facets - create facets (filtering options) for search results page,
Ranking and Personalization Ranking and Personalization - manage how results are ranked,
Synonyms, Redirects, and other search features are also managed through Nosto Dashboard (my.nosto.com).
Autocomplete provides keyword suggestions to assist users in completing their queries, supplemented by a selection of the most relevant products with the ability to see all products on the search results page.
Check out autocomplete's look & feel guidelines.
When integrating Autocomplete you have the option to directly access the API, or you can use our existing Autocomplete JavaScript library that provides most of the required functionality out of the box.
API can return highlights indicating which parts of a keyword match the search query. This HTML can be used to render and emphasize the matching sections during display.
Redirects are configured in the search dashboard and can be used to forward users to specific pages depending on what they type into the search field. For example, users searching for "shipping" could be directed to https://example.com/shipping.html.
API only returns redirect url, the actual browser redirect must be implemented by the merchant on keyword selection
To analyze user behavior you need to implement tracking. This can be achieved using our JavaScript library. You need to implement the following methods with type = autocomplete
:
recordSearch to track users typing in the search field and viewing suggestions
recordSearchClick to track clicks on autocomplete suggestions
Additionally, see the tracking instructions for search form submissions.
Each autocomplete product click should be tracked as a search page virtual view to ensure that the Google Analytics search feature displays the correct conversion rate. For example, if you click any product when the typed query is phone
it should track a virtual page view with the URL /search?q=phone
(adjust the search path and query parameter to match your search page).
Since a product link click would redirect to a new page, to ensure that Google Analytics has time to send the tracking request, it's recommended to save the search query to local storage and track it on page load.
internal facet ID, used to select
facet field, should be used for
user friendly facet name configured in the
user friendly facet name configured in the
facet field, should be used for
internal facet ID, used to select