How to enable this feature?
This feature is disabled by default which means that you will need to enable it:
- Go to Settings / Google Tag Manager on your WordPress admin area
- Click on the Basic data tab
- Click on the Search subtab
- Put a check mark into the box shown on that page
Enabling this will allow you to access the following Data Layer Variables on all pages:
siteSearchTerm
Includes the term the user was searching for on the search results page. Usually it is not needed to use this to track internal site search in Google Analytics as it can be tracked easily by adding the s parameter in Analytics.
You may want to use this Data Layer variable to track certain micro conversions or remarketing conditions.
siteSearchFrom
Includes the source page of the search. For example if you include a search box in one of your sidebar widgets, this Data Layer variable will include the URL of the page where the user entered the search term.
siteSearchResults
This variable will include the number of results on the search results page. You may want to use this to track empty result pages along with search terms so that you can see what information users are looking for that can not be found on your site.