Example Code Request for a Custom Visitor Target

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

  1. 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)

  2. Map the visitor target to the visitor target in the Hawksearch admin as shown below from the visitor targets section:

     

  3. Identify the Visitor Target Id in the admin screen (https://dev.hawksearch.net/settings/buckets/ )

     

  4. 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

Related articles