Custom Visitor Targets

Custom visitor targets are useful when more functions are required which may be either too complex to be configured on the workbench with existing visitor targets or the existing options do not support the requirement. One popular use case is to perform a specific operation based on the current session or other inputs calculated dynamically.

 

Through custom visitor targets, Hawksearch gives an extra option to pass information other than those configurable through normal visitor targets.

Since the values are not pre-determined, they can be anything in the request sent by your website or service, some example values for the custom option are:

  • For all mobile users: hawkcustom=mobile

  • For all authenticated users: hawkcustom=authUser

  • For guest users: hawkcustom=guest

  • For reward enabled members: hawkcustom=pointsmember

 

Usage

For Hawksearch v2.0L to v4.0L versions:

Custom visitor targets are passed by the URL parameter “hawkcustom

For Hawksearch v4.0 version:
Custom object must be sent - line number 8

{     "IndexName": "YOUR_INDEX_NAME_HERE",     "ClientGuid": "YOUR_CLIENT_GUID",     "ClientData": {         "VisitorId": "6617eede-afab-48b9-8096-9b532ba73058",         "VisitId": "a89e87ff-8319-4717-b1dd-9b34254986d7",         "UserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.41",         "Custom" : {"custom" : "VALUE_HERE"}     } }

 

More custom attributes

Note the repetition of “custom” twice in the above example. The first (outer) attribute indicates Hawksearch that the data it holds is information additional to the default search request.

The second occurrence of “custom” is applicable when the option Custom is selected in the Visitor Target’s Add/Edit page dropdown during its creation:

 

The above options in the dropdown list are predefined. However, business criteria may arise where the custom attribute is not sufficient, such as key-value pairs where both key and value are custom business needs; or the need to pass extra information about the logged in user such as current county, user tier, customer type, etc.

Hawksearch will be able to provide more choices upon request where in a Hawksearch developer will create the options for the dropdown, as example below:

E.g.: You have a Channel Id to calculate dynamically and pass to Hawksearch. Based on this Channel Id, you’d like to create a Visitor Target in Hawksearch workbench. But there is no option to pass a Channel Id. So you contact the Hawksearch Team which creates a new attribute to filter by as below and provides the key to be sent during the search request, in this case, let us assume the key is channel_id:

After creating a visitor target and setting up workbench to use it, you would need to send the visitor target value as follows (line 5):

{ "IndexName": "string", "ClientData": { "Custom": { "channel_id":"abc" ... } } }

 

Upon receiving the search request with the above request parameter, Hawksearch recognizes that the parameter corresponds to the visitor target and proceeds to send the search response accordingly.

 

See also:

More examples of visitor targets Visitor Targets Strategies

Custom visitor target with tracking and recommendations Example Code Request for a Custom Visitor Target