No Keyword in URL: Google Analytics Site Search
Google Site Search tracking is a valuable tool, however it requires that your site search keyword is contained in your URL. What if your website platform doesn't support this?
There is a solution. It's not pretty and its even a little bit technical, but it's possible.
Firstly, you need access to your websites template files, and in particular the template that displays search results.Secondly, you need to be able to "inject" the search keyword into the template file.
If you are confident with the above, forge ahead. If not, talk to your web developer as these changes should be relatively straight forward for someone with experience.
Step 1
The first step is to add the following line of code to your existing Google Analytics tracking code:
pageTracker._trackPageview('/search?q=[keyword]');
Your tracking code should look something like this:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-635744-1");
pageTracker._trackPageview();
pageTracker._trackPageview('/search?q=[keyword]');
} catch(err) {}</script>
Step 2
Next, we need to replace [keyword] with the actual keyword being searched for. The method in which you do this will vary depending on the website platform you use. A PHP platform might handle it something like this:
pageTracker._trackPageview('/search?q=<?php echo $keyword; ?>');
Where $keyword contains the keyword string used.
Step 3
Lastly, we need to tell Google Analytics to look out for the query string used, which in the example above is simply 'q'. This needs to be placed into the "Query Paramater" box in the Site Search section in your Google Analytics profile:
Step 4
Run a test search yourself and then view the HTML source to ensure your keyword is being inserted into the pageTracker javascript call.
Check your Google Analytics reports (Content > Site Search) over the next fews days to make sure search data is coming through, and then start analysing and acting!
I Read your Google Analytics Site Search.It is very mostly require for all business site. you wrote step1 sing up in google anlytics and receive a Google Analytics tracking code: and past in your home page html coding.
Post a Comment