Example Code Request for a Custom Visitor Target
Overview
This documents an example of a request that contains a custom visitor target. A common use case for this functionality would be for customers logged in versus customers not logged in and displaying custom pricing for the logged in customers.
Instructions
-
Set the Hawksearch.context.custom property as follows
Hawksearch.Context.Custom.add("custom", "LIN");
(//LIN here just is a value I am using to represent logged in) -
Map the visitor target to the visitor target in the Hawksearch admin as shown below from the visitor targets section:
-
Identify the Visitor Target Id in the admin screen (https://dev.hawksearch.net/settings/buckets/ )
-
Use the Visitor target id in the layout to adjust the layout as needed and show the correct conditions based on the visitor target assigned.
{{#visitortarget in="155"}} {{$custom.member_price}} {{/visitortarget}}
Where member_price is your custom price for that member
Updated over 1 year ago