Can I install Sajari with Google Tag Manager (GTM)?

Yes, follow the steps below.

Step 1

Sajari is a "custom HTML tag," you can select this when adding a new tag as per below:


Step 2

Sajari is typically a global install, so you can activate across your entire site as per below. Don't worry about hiding various pages from your site search, you can easily exclude them later using "crawling rules".


Step 3

You can access your install code from within the Sajari app itself (if logged in). Or you can cut and paste directly from below.


<script type="text/javascript">    window._sj = window._sj || [];    _sj.push(['project', '<PROJECT>']);    _sj.push(['collection', '<COLLECTION>']);    (function () {        var sj = document.createElement('script');        sj.type = 'text/javascript';        sj.async = true;        sj.src = '//cdn.sajari.net/v2/js/sj.js';        var s = document.getElementsByTagName('script')[0];        s.parentNode.insertBefore(sj, s);    })();</script>



Copy the code on the left, replace <project> and <collection> with your actual company and collection names.</collection></project>

Once you've completed the above steps, your content will begin to index and build statistics around popularity, recency, etc to optimize your search and recommendations.

How to hide a field in a search interface?

Background

When you generate an interface via console for a Site Search collection, we return title, description, URL, and image(optional) in the search results. In some instances, you might want to hide title, description, or URL.

Limitation

Our default interface uses URL field for click-tracking, and it must be returned in response, otherwise, the click-tracking won’t function. Hence, if you try to remove URL field, it will return an error:


tracking field 'url' missing from result.

Instructions

To hide ‘title’ or the ‘description’ field from the search interface:

  1. Generate an interface from the Integrate section in the console.
  2. After choosing the relevant options, and generating an interface, click on “View code“
  3. Add the “fields” parameter in the values object. See example below which will only return and render ‘title’ and ‘URL’:

values: {"q.override": true, "resultsPerPage": "10","q": getUrlParam("q"), "fields":'title,url'}