No results: Use Hawksearch Popular searches and campaign
If the customer types in a search word that does not yield any results, you have an opportunity to communicate with them by adding relevant text messages, targeted ads, banners, and widgets using Hawksearch dashboard.
Example use case: Display Popular searches for no results search page.
Step 1: Set up a content item like below by adding default Popular searches widget.
Steps to add a Content Item: Content Items | ContentItems AddingaContentItem
Step 2: Set up a campaign that would define the trigger when the Content item created above should be returned in the response.
Steps to add a Campaign: Campaigns | Campaigns AddingaNewCampaign
Step 3: Please confirm that the Popular searches Content item is being returned in the response for no results page.
Request: POST request to search keyword “abcdefg”:
POST /api/v2/search HTTP/1.1
Host: searchapi-dev.hawksearch.net
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: b1dc5ba6-9262-bc68-c48a-0a344afe5316
{
"index":"elasticdemo.20210325.082034",
"ClientGuid": "f12458r1c38446f0bacdf283390c37e8",
"keyword":"abcdefg"
}
Response: In the search results response structure, there are 2 main keys which include the information about the Content item/Campaign created above:
“Output” is the array of key-value pairs of top keywords and their count.
“Trigger” indicates the Campaign information and the rule being used to insert the content item in the response.
"Merchandising": {
"Items": [
{
"Zone": "LeftBottom",
"Title": "Popular Tags",
"ContentType": "widget",
"Output": [
{
"keyword": "jacket",
"count": 282
},
{
"keyword": "red jacket",
"count": 149
},
{
"keyword": "print",
"count": 83
},
{
"keyword": "jackt",
"count": 36
}
],
"IsMobile": false,
"IsTrackingEnabled": false,
"MobileWidth": 0,
"MobileHeight": 0,
"Trigger": {
"BannerGroupId": 56254,
"Name": "No Results Page - Popular Searches",
"SortOrder": 0,
"Rule": {
"RuleType": 0,
"Field": "",
"Condition": "",
"Value": "",
"FieldType": "System.String",
"Guid": "6121d5d07b6e46969c858e8bd7ca079c",
"ShouldEvaluateAfterSearch": false,
"Operator": 0,
"Rules": [
{
"RuleType": 1,
"Field": "nofresults:nofresults",
"Condition": "equals",
"Value": "0",
"FieldType": "nofresults",
"FieldName": "Number of Results",
"FieldValue": "0",
"Guid": "d9e11cbb6d5d48f9add325e7bd93fc88",
"ShouldEvaluateAfterSearch": false,
"Operator": 2,
"Rules": []
}
]
}
},
"BannerId": 0,
"CampaignId": 56254
}