Hi:

Our Drupal 7.x install uses clean urls, path auto and redirection plugins. Things work great, however, when google adwords sends the querystring/GET parameters once a user clicks on an ad, it contains a "q" parameter that has the keywords used. The problem with this is that q is reserved within Drupal and basically the site just 404s out the request. So, if a user goes to the page http://domain.ext/my-page it works great, but if they go to http://domain.ext/my-page?some=var&another=googlevar&someother=googlethi..., then it dies.

Of course, none of the parameters other than q= are an issue.

For Drupal 7, does anyone have a workaround to make Drupal use something other than "q" as the main parameter for everything it does when clean urls are enabled? I have found some things talking about workarounds in 5.x, but not in 7.x. I found a post that talked about changing this parameter within google, but we don't have that option because of hte "advanced" method we are using.

Added to this is that we are using the "redirection" plugin, so whatever we do has to make its way down to that plugin as well.

Any help would be much appreciated as we are unsure how to keep things working well when the extra q= is passed over from Google.

Thanks.

Comments

lordoxide’s picture

We are having the same problem, in fact any Drupal users who have live Adwords PPC ads are returning 404s, so this is a major issue. Currently we have the following work around in place (which fixes the 404s) but it is causing duplicate content because both SEO friendly and normal links now work.

We added this to the bottom of sites/default/settings.php
#This sets the original variable of 'q' to the contents of 'drp'
global $custom_query_string;
$custom_query_string = "drp";
$_GET['q'] = $_GET[$custom_query_string];

Then in our .htaccess file we changed the following line:
from: RewriteRule ^(.*)$ index.php?q=$1
to: RewriteRule ^(.*)$ index.php?drp=$1

This does get us back to working, without 404s on all of our ads, but we now have duplicate content concerns, with page rank implications.

Hope this helps as a bandaid while Drupal comes up with a permanent fix.

Thanks,
Tom C.

ipllc’s picture

Thanks, Tom. You're right--I was encountering 404's just because I happened to check it when setting up a new ad campaign. Your quick fix is much appreciated.

ipllc’s picture

As a follow-up, making the changes to the "q=" section in the .htaccess has seemed to create a myriad of problems. I'm going to disable AdWords for now, but this continues to be a BIG problem for anyone running AdWords campaigns that point to a drupal website.

ipllc’s picture

Here's a solution that seems to work for me (however I'd love someone with more REGEX experience to suggest improvements). I've added the following to the .htaccess file just below the RewriteEngine on line:

RewriteCond %{QUERY_STRING} ^(.*)&q=(.*)$
RewriteRule ^(.*)$ /$1?%1%googleq=%2 [L,R=301]

This checks for the "&q=" that Google AdWords is adding and replaces the "q=" with "googleq=", letting drupal use it's native query/path method while retaining the search query data.

web wonks’s picture

Any Kiwi's needing help with Drupal connections and Google AdWords can contact the Web Wonks for further information.

http://www.webwonks.co.nz

AlbaniaProperties’s picture

Have given up on adwords for the time being.

www.albania-properties.co.uk