Introduction| Hitchhikers Platform
Generally a website will have a search bar on the main domain. This search bar could be persistent in the header and might also have a search bar more prominently on the homepage. It could also be added through an “overlay” module. If you add a search bar to your header, you will link the user out to a separate results page where Search will be served. If you add a search bar through the “overlay” option, you can present Search inline, within the overlay panel, or you can use a redirect URL and link the user out to a separate search results page. This guide will walk through both of these options.
Before You Begin
To make the process quick and seamless for adding a search bar, we’ve added a new Search Snippet Generator to the Yext platform that will automatically populate the fields below with the variables from your account. The snippet provided in the Yext platform will include all three steps of initializing the library, placing, and styling the search bar. This is currently only available for the static search bar, and not the overlay option. We will reference the Search Snippet Generator throughout this guide when you can pull the code snippets provided in the platform. Follow Step 6 in this guide for complete steps on how to use the Search Snippet Generator.
If you are not using the Search Snippet Generator, make sure you have the following pieces of information before you begin:
experienceKey - Experience Key
businessId - Business ID
apiKey - Live API Key
locale - Locale of the experience
redirectUrl - This is the URL of the search results page
querySource - This is an optional property to set a custom integration source for your site, in the event you have multiple search bars that lead to the same search experience, so that you can differentiate the search bars in your Analytics. If you do not wish to set this property, remove this line and it will default to “STANDARD” or “OVERLAY” depending on the search integration you use.
Reach out to your Yext Administrator to obtain the above information if you do not have it.
Option 1 - Static Search Bar
If you would like to integrate using the first option of adding a static search bar to your webiste, there are three steps to adding a Search bar:
- Initialize the Library
- Place the search bar
- Style the search bar
Here’s an example with a search bar in the header and in the center of the homepage:
We recommend this option for discoverability and increased search volume.
Option 2 - Overlay
If you’d like to integrate using the second Overlay option, there is one main step to get it up and running. To do so, you can start on Step 4 of this guide.