wesley tanaka

Using Google AdSense for Search in Drupal

‹ Olfactory SMS | Convert Videos for playback on Nokia N82 in Fedora 8 ›

Google AdSense for Search has a "Open results within my own site" option, which allows you to display search results within pages on your own site using javascript. By default, it relies on a "q=" GET parameter, which conflicts with Drupal.

You can get around this problem by renaming Google's "q" parameter to "as_q"

  1. Change
    <input type="text" name="q" size="31" maxlength="255" value="" id="sbi"></input>
    to
    <input type="text" name="as_q" size="31" maxlength="255" value="" id="sbi"></input>
  2. If you are linking to queries directly, change:
    http://example.com.....&q=some+search+string&sa=Google+Search&.....

    to
    http://example.com.....&as_q=some+search+string&sa=Google+Search&.....
    (change example.com to your own domain name)

Suggested Links

Syndicate content