If you have your own shop, you are on top of numbers. In order to serve your customers better you give them as much as you possibly can in terms like service, product information and product suggestions. Since the most valuable numbers can be collected in Google Analytics (like amount of visitors, keywords and general e-commerce tracking) this contribution adds even more valuable information to Analytics.
Collect what your visitors search for
To spot trends early it’s a good idea to track the search queries of your visitors. This allows you to catch misspellings or related items with an high demand. With this information you can e.g. put common misspellings in the description of an item or start selling related products to items you already sell.
A few contributions already allowed you to track search queries, but most of them collected them in the administrator panel. To keep the administrator as clean as possible, you want to collect information in a environment capable and designed for tracking information. Google Analytics suits this job. Therefor you can find your visitors search queries from your shop back in your Analytics account.
What this contribution does is adding a fake page request (the search keywords) to your statistics. This way, it looks like an ordinary page view but it is in fact a search query from a visitor. Valuable information for you, the shop owner!
Only one file needs to be modified which takes you less then a minute. And again: the effect is amazing.
Needless to say: you got to have a Google Analytics account already collecting data. This is based on the new Google Analytics tracking code. If you use the lagacy tracking code (check for urchin.js in your code) please use the installation guide included in the contribution.
Add the following code before </body></html> to your /catalog/includes/footer.php file OR (if you collect data in the header) place the code before </head> in /catalog/includes/header.php. Where UA-XXXXXXX-X is your personal Google Analytics code (e.g. UA-1234567-1).
- Upload modified file “advanced_search_result.php” to your /catalog/
- Try a few noticeable search queries on your website e.g. “TEST”.
- Your search query will show up in Analytics within a few hours (takes a while for Analytics to process the statistics). You can find your search query under: “Content -> Top Content”.
The result (under Content -> Top content) should look like this:
The contribution is available from the osCommerce Add-ons page: Track search queries