Currently the search results and search category are recording but we suggest making two changes:

  1. There are two methods to enable internal search results tracking (use one OR other):
    1. Change the URL:

      www.clientdomain.com/search.html?submit=search

      &siteSearch={KEYWORD}

      &searchCategory={CATEGORY} e.g. /shoes/

      &numResults={9}

    2. Add a virtual pageview to the header dataLayer:

      <script>

      window.dataLayer = window.dataLayer || [];

      dataLayer.push({

      “pageVirtual”: “/virtual” + “/search.html?submit=search&siteSearch={KEYWORD}&searchCategory={CATEGORY}&num_results={9}“, //lowercase

      “pageGroup2_category”: “searchresults”

      });

      </script>

 

  1. In order to record a “0 results” the code below needs to be added:

    Using GTM this will need to display as below. Replace the elements in bold with server-side values.

    <script>

    window.dataLayer = window.dataLayer || [];

    dataLayer.push({

    “pageSiteSearchResults”: “0

    });

    </script>

 

 

0117 3361103

FREE GOOGLE TAG MANAGER BOOK

For the PDF Copy, please enter email address
DOWNLOAD
close-link
Click Me