Drupal autocomplete

Drupal Autocomplete

Rate this article

Share this article

Here are steps to create a drupal autocomplete. In this method, we will use expertrec to create a Drupal Autocomplete search engine and use Google Tag Manager to add it to your drupal site.

Drupal autocomplete

Advantages of having a Drupal Autocomplete

  1. Faster searches.
  2. Reduced spelling errors and typos.
  3. Ease of finding products and content.
  4. Improved sales and conversions.

Steps to create a Drupal Autocomplete

  1. Create a drupal custom search engine using expertrec from https://cse.expertrec.com/?platform=cseDrupal autocomplete
  2. Inside your expertrec control panel, enter your drupal sitemap URL.
  3. Wait for your site crawl to complete.
  4. Download and Install google tag manager extension for drupal from here. https://www.drupal.org/project/google_tag
  5. Once you install, enter your google tag manager ID. Click on save the configuration.Drupal autocomplete
  6. Go to https://cse.expertrec.com/csedashboard/home/code and copy your code.
  7. Copy the first part of the code in your control panel
  8. <script>
    (function() {
    var id = 'YOUR_API_KEY';
    var ci_search = document.createElement('script');
    ci_search.type = 'text/javascript';
    ci_search.async = true;
    ci_search.src = 'https://cse.expertrec.com/api/js/ci_common.js?id=' + id;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(ci_search, s);
    })();
    </script>

    Add this code to your google tag manager. Replace YOUR_API_KEY with your API key.Drupal autocomplete

  9. Add Triggers ( set to all pages).
  10. Go to Structure-> Block layout-> Header ->Place block-> Add custom block-> click on source and enter the following code. (choose full HTML). This places the search box in your header
    <ci-search></ci-search>Drupal autocomplete

     

  11. Click Save.
  12. Now the search box will be added to the header section of your drupal site.Drupal autocomplete

Add Custom Search to your Website

Are you showing the right products, to the right shoppers, at the right time? Contact us to know more.
You may also like