Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Request for Landing Page
http://dev.hawksearch.net/sites/demo/?lpurl=/accessory&hawkoutput=html&hawkrobots=allow

...

JavaScript Block

The following JavaScript needs to be installed on every page of your site. The block should look as follows. Please either adjust or add as needed. The enginename is the engine ID associated with your Hawksearch account. The ClientGuid is the Tracking Key associated with your account.

Info

To lookup the Engine Name and Tracking Key for your account please look in the Hawksearch workbench under Admin >> Account Info.

Code Block
<!-- Hawksearch Header Includes -->
<script type="text/javascript">
    //<![CDATA[
    (function (HawkSearch, undefined) {
      HawkSearch.HawkUrl = 'http://dev.hawksearch.net/sites/enginename';
      HawkSearch.TrackingUrl = 'http://tracking-dev.hawksearch.net';
      HawkSearch.RecommenderUrl = 'http://recs-dev.hawksearch.net';
      HawkSearch.ClientGuid = 'tracking_key'; 
      if ("https:" == document.location.protocol) {
      HawkSearch.HawkUrl = HawkSearch.HawkUrl.replace("http://", "https://");
      HawkSearch.TrackingUrl = HawkSearch.TrackingUrl.replace("http://", "https://");
      HawkSearch.RecommenderUrl = HawkSearch.RecommenderUrl.replace("http://", "https://");
        }
    }(window.HawkSearch = window.HawkSearch || {}));
      var hawkJSScriptDoc = document.createElement("script");
      hawkJSScriptDoc.async = true;
      hawkJSScriptDoc.src = HawkSearch.HawkUrl + '/includes/hawksearch.min.js?v1.0';
      var hawkJSTag = document.getElementsByTagName('script')[0];
      hawkJSTag.parentNode.insertBefore(hawkJSScriptDoc, hawkJSTag);
      var hawkCSSScriptDoc = document.createElement("link");
      hawkCSSScriptDoc.setAttribute("rel", "stylesheet");
      hawkCSSScriptDoc.setAttribute("type", "text/css");
      hawkCSSScriptDoc.setAttribute("href", HawkSearch.HawkUrl + '/includes/hawksearch.css');
      document.head.appendChild(hawkCSSScriptDoc);

    //]]>
</script>

...

Auto-Complete for Search Results

Within the Hawksearch Workbench, settings can be modified to control what shows in the Auto-Complete section.

To enable it on your page, there are two steps:

  1. Add the Auto-Complete JavaScript block to the end of the <BODY> tag.

textboxname is the ID of the search text box. Look to your existing HTML code to add the matching ID.

textboxnamefooter is the ID of the search text box if you have one on the footer. Look to your existing HTML code to add the matching ID.

Code Block
   <!-- Hawksearch - Auto-Suggest -->
    <script type="text/javascript">
        //<![CDATA[
        HawkSearch.initAutoSuggest = function () {
            HawkSearch.suggestInit('%%textboxname%%', {
                lookupUrlPrefix: HawkSearch.HawkUrl + '/?fn=ajax&f=GetSuggestions',
                hiddenDivName: '',
                isAutoWidth: true
            });
            HawkSearch.suggestInit('%%textboxnamefooter%%', {
                lookupUrlPrefix: HawkSearch.HawkUrl + '/?fn=ajax&f=GetSuggestions',
                hiddenDivName: '',
                isAbove: true
            });
        };
        //]]>
    </script>

...

HTTP/Keep-Alive

In the event that you see unexpected timeout errors from the site when testing, please confirm your http web request settings for the request you make to hawksearch. In some cases, the clients reset the connection instead of leaving it in Time_Wait/Close_Wait causing IIS to log it as an interruption. In this scenario please force the request to be Http 1.0 with no keep alive and see if timeouts no longer appear.

...

Event Tracking Code

Info

NOTE: In order to populate data in the Hawksearch Reports, and to leverage Personalized Search, it is CRITICAL to implement Tracking Integration.

Click here for instructions on adding Hawksearch Event Tracking Code .