Installing Sajari with Google Tag Manager (GTM)

If you currently use Google Tag Manager, below provides instructions on how to install
Sajari site search and recommendations into your website.

If you haven't signed up with Sajari yet, you can sign up here. Once you've
created an "engine", you will be given a snippet of code which you will add as per step 3 below.


Step 1: Create the tag

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


Step 2: Where to fire

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 omit them later using "crawling rules".


Step 3: Add the install code

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

Copy the code

Below is the generic install code to connect your website to Sajari. This code is asynchronous and will not slow your site down. It will also not interfere with existing search or recommendations functionality. This is just a base install to connect instant indexing of your site content and to enable other functions to be installed when you choose to do so.

In the below code, please replace <PROJECT> and <COLLECTION> with your actual company and collection names.

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

Now what?

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. You can then add simple site search plugins and/or recommendations easily by following instructions here. Alternatively you can build advanced interfaces using our ReactJS SDK, which offers much greater functionality including facets, autocomplete and more.

Successful businesses use Sajari