Google Analytics Site Search URL parameters

Richard Eriksson - November 5, 2007 - 18:17

Google Analytics just announced site search tracking, and since it's looking for query parameters, will this work with Drupal. I think Google Analytics is looking for URLs like example.com/search?query=google+transit but Drupal sites typically have URLs like example.com/search/node/google+transit

When enough people tell them

gpk - November 6, 2007 - 00:04

When enough people tell them that their search box submits the search terms to the website using POST rather than GET then I expect Google may add the ability to parse the URL itself. On the other hand this is a bit more complex than retrieving a simple query parameter, so it may be a while in the coming.

Meanwhile not too difficult to create your own search form (or use hook_form_alter()), setting the form's #method to GET so that the query is visible to urchin.js, and then on the Drupal side pulling the relevant stuff out of $_GET and using drupal_goto() to do an internal redirect to the relevant search/node/... path. There are probably other ways too.

gpk
----
www.alexoria.co.uk

There's a pacht for Drupal Analytics module

jmesam - February 2, 2008 - 18:39

There is a patch for Drupal Analytics module (by now only for Drupal 6.x): http://drupal.org/node/200701

Ah that looks promising. My

gpk - February 2, 2008 - 19:23

Ah that looks promising. My suggestion wouldn't have worked anyway because drupal_goto() doesn't do an internal server redirect - it causes the new URL to be sent to the browser. A more successful way might have been to fiddle with $_GET['q'] directly.

gpk
----
www.alexoria.co.uk

 
 

Drupal is a registered trademark of Dries Buytaert.