Google Adsense internal search code does not work with Drupal sites normally. The reason is $_GET[q] conflict between both services. $_GET[q] means "current page" for Drupal and "search query" for Google. We can fix it with two easy steps.
Step 1:
Create a custom page like "websearch" etc under Drupal and add Adsense Code for results page.
Step 2:
Add this code at the top of your Drupal's index.php:
// Fix Drupal-Adsense conflict
$_GET[q] = ($_GET['cx']) ? "websearch" : $_GET[q] ;
- Log in to post comments
Added to DrupalSightings.com
Added to DrupalSightings.com
Awesome!
Thanks, it worked! That was a quick fix compared to all of the longer methods I have seen previously.
Good
All ingenious is simple.
Google's solution
You can try to use
parameter for search results. And don't forget to change this input name in search form, ofcourse.
Enjoy.