There are some situations where numbers in our reports can confuse us.
One of those is when you see that there are more people who visit your website than the actual number of page views e.g. 5000 visitors and 2000 page views.
How is it possible that those 3000 visitors did not ‘see’ my website?
In Piwik PRO there are some actions that do not trigger Page View events. One of those actions is internal site search. Using a search bar on your website helps visitors to quickly find what they are looking for and it will help you get to know what your audience is interested in the most.
There is a scenario where the number of visitors will seem inflated. Specifically, when a search engine (like Google) or people around the web share link to your site with a search query parameter attached, like: funnycats.com**/?query=MisterMittens**. You may find detailed examples below:
A visitor goes to your website directly by entering the address or from Google’s search result. On the site they find your search bar and type to find ‘Mister Mittens’.
Using internal search does not fire a page view by itself but you already got one page view when your visitor entered your domain. In this baseline scenario the each visitor will have at least one page view.
A visitor goes uses google.com and searches for ‘Mister Mittens’. They go through all the results and your website appears as one of them. Unfortunately Google cached your URL with an internal search query in it (e.g. funnycats.com/?query=MisterMittens). When the visitor enters this site Piwik PRO will recognize this as an internal search without firing a page view since the visitor might not even visit your page.
In this situation we will have one session of this user with one search event.
If you drive your marketing campaigns to your site with a search filter you may end up with not so realistic visitors/page view ratio.
The default behavior protects against multiple page views generated by one search event. This might be the case with most implementations of internal site searches.
In case you want to track all of the internal searches and match them with page views to make data clearer you can do this in two ways:
⦁ Option 1 (recommended): New page view trigger using Tag Manager
Go to Menu > Tag Manager and click Add new tag. From the list of tags search for Piwik PRO virtual page view.
In the tag’s setup you need to set a virtual URL that will be shown in reports. It doesn’t have to be an existing page (e.g. https://mywebstite.com/virtual_search_view ).
Next add the Page view Trigger and set it to fire when conditions are met. Choose Page Url > contains > .
(Note: there are several query parameters in URL: q, query, s, search, searchword, keyword). You need to check what type of query parameter your website is using.
In our example it’s “?s=”:
When you run it, every time there is an internal search on your website the new virtual page view appears with it.
Here is our official documentation article about Virtual Page view:
⦁ Option 2 (advanced): Override the default tracker behavior and track every search as pageview
First, you need to check what query parameters your website is using and delete it from the list of parameters in Menu > Administration > <<your_website>> > Internal search engine tracking.
Next you need to go to Tag Manager and set a custom variable with a type Custom JS.
Here you will need a function who will gather and return information about searched item:
var urlParams = new URLSearchParams(window.location.search);
In our example website uses ‘q’ query parameters which was deleted previously from the administration settings.
Further you need to create a new Custom asynchronous tag and enter a script who will track internal searches with all additional information:
In the code above there is a variable that gets the number of results and pushes it with a custom variable (product name) to our tracker.
Last step is to add a new Page view Trigger which fires when Page URL > contains > ?q= .
More information about tracking internal searches are available here: