Track keywords that people use to search on your website

The Site Search report will be tracked automatically if you have some search box on your website. It will be tracked by default if you are using query parameters. It’s very useful if you are tracking easy search box.

There are some websites that have more complex search boxes or a few of them applied on one website. Then the method that is shown below comes in handy.

1. To track Site Search using Tag Manager it is necessary to use Analytics Tracking API. Specific methods need to be invoked when searching on a site takes place, having few pieces of information provided:

  • Keyword searched;
  • Optionally, search category;
  • Optionally, amount of results returned.
  • 2. You need to execute such line of the code:


    3. You will need between 1 or 3 Variables to be able to send such calls from Tag Manager template.

    4. Each should be defined appropriately to how specific piece of information is available so in the end your code will look like this, as it will be using TM variables:


    5. There is no need to invoke trackPageView after trackSiteSearch, as it is sent instantly as separate action.

    Was this article helpful?

    of people found this helpful

    Technical Support

    If you have any questions, drop us a line at

    We’re happy to help!