Where “keyword” is replaced (by YOU) with the actual keyword that each particular visitor searched for.

This replacement can be done in several ways.1. CMS script – your CMS system may have a template scripting language that allows you to reference the keyword value.

2. JavaScript – If your results URL is in a standard format and includes the keyword, you may be able to extract the keyword with a regular expression.
This might look like:
var s = location.pathname;
var re = new RegExp(“/search/([^/]*)/?$”);
var m = s.match(re);
pageTracker._trackPageview(‘/search/?q=’ + m[1]);
*Assuming the results page is in the format http://www.mysite.com/search/keyword
and further assuming my JavaScript and regex are even remotely accurate ? — meaning don’t just use this example code and expect it to work, this is to demonstrate the *concept* only

3. Server side scripting language such as asp, php, cold fusion, etc.
This might look like:
pageTracker._trackPageview(‘/searchresults/?q=<?php echo $keyword ?>’);
*Assuming you have a php variable named “keyword” that contains the search terms used. Don’t just insert this example code into your site and expect it to work — this is to demonstrate the concept only

So the technical details of how you programatically get the keyword into the string of text that you pass to _trackPageview(. . .) will differ from case to case. But the ideas above should get your web developer started in the right direction.

We value your privacy

We and our media partners use technology such as cookies and website analytics tracking, which collect information about you such as your IP address and browser information. We use this technology to personalize content and ads, provide social media features, and analyze our website traffic. Click I Accept below to consent to the use of this technology on our website; otherwise it will be disabled during your visit. For more information, visit our Privacy Policy.