Forum Moderators: phranque
The only way to explain my problem is to start at the top. If Apache is not where the problem lies then please tell me and at least I've discounted something.
Google Adwords has a tracking service. This service allows me to see the conversions of my Google Pay Per Click's. At some point along the tree of my site is a page where I have put a bit of Google code. When the user hits this page Google will know that a conversion has taken place. Adwords of course needs to put a variable on the end of each of my URL's which only appears for PPC customers as a session ID.
The session ID looks like this
www.example.com/ferraris/niceferraris&gclid=5A4278937638762 (or some alphanumeric)
Understand? Simple enough I'd have thought.
My website doesn't work properly with this variable though. It tries to lookup in the DB, build this page and as a result shows nothing because it's made a page called niceferraris&gclid=5A4278937638762
Can we get Apache to ignore &gclid= and also anything alphanumeric that appears immediately after it, A-Z 0-9. I have php code that will take any bad URL to the homepage but that of course doesn't allow my Tracking - the customer wouldn't be able to go anywhere!
What I don't want though is for someone to write any other string on the end such as &listdatabasefields (if you get me).
Now I would try and nut this out but quite simply I cant. I'm willing to learn though which is the main thing.
Can you help?
To fix this, change it so that it only looks at everything up to any question mark (if one is present). That's likely a change in your script, not in the .htaccess file.
It is unclear how the requested URL is rewritten to your script, so it is entirely possible that .htaccess could be amended as well as the script to make a more robust solution.
What I've asked is that if we allow this variable to be passed through the site but not parsed. I'll then get a nice htaccess file together to return a 404 for any other variable.
As far as I know this'll do the trick
thanks
Interestingly, regarding your initial typo, I sometimes do see real requests for
/somepage[b]&[/b]param=value and have specifically added a 301 redirect to catch it and redirect to www.example.com/somepage[b]?[/b]param=value for all.
Just login to your adwords account and go to this page:
[adwords.google.com...]
Click ( edit ) to Change:
Tracking - edit
Auto-tagging: Yes
To No, and this will remove the gclid from your URLs. Google adds these in by defaults for 2 reasons, 1 to help prevent traffic from your AdWords increasing your SEO ranking and 2, which is the publicly used reason as Google Analytics by default can't read traffic from AdWords without this tag.
So while doing this will remove the gclid problem from your site, it will also mean if you are using Google Analytics to track the traffic from AdWords it will no longer be tracked separately and will be considered SEO traffic in the reports. So the traffic is still 100% tracked, it is mixed in with the SEO traffic.
For conversion tracking you can still use the AdWords conversion code on your website and it will work 100% without problems as it works on cookies not URL patterns.
Hope that helps solve your problem.
Stephen
Many thanks for your reply, and to everyone else who has posted to my problem.
Yes your absolutely right you can (and I temporarily have) removed Google Auto-Tagging.
I reckon this was auto-enabled when I first started using Analytics.
I didn't know that about Adwords using Cookies. I know it was an analytics thing but I thought it would help adwords also.
Thanks
Chris