Trailing Slash for Google AdWords
Google AdWords can be an essential part of your marketing strategy. In order to achieve the best performance while maintaining the integrity of your marketing data, you will need to do one simple change to your URL’s to make this happen.
As a best practice, you should always add a trailing slash to the end of your URL before your GCLID code. For example:
Correct:
http://domain.com/landing-page/?gclid=CMA56qe1ocdCFUccgAod3V8aDQ
Incorrect:
http://domain.com/landing-page?gclid=CMA56qe1ocdCFUccgAod3V8aDQ
By default, WordPress will automatically redirect a URL with no trailing slash to a URL with a trailing slash. You can see this by running the following curl statement:
curl -IL https://wpestaging.qa/migrations/
The curl statement returns a 301 Moved Permanently
and redirects the user to the same page but this time includes a trailing slash.
WP Engine servers drop the gclid=foo
args in the backend as well, because the values in that query parameter are always different but the page’s content is always the same.
This allows us to cache the page and provide awesome performance. However, because of the 301 redirect
, the gclid is lost and marketing data is skewed.
If you return a 200 Success
response code by making sure the trailing slash is in place when a user clicks the link, the gclid query string can be used. This will allows our servers to cache pages while also allowing your marketing data to remain current.
The good new is that WordPress adds trailing slashes by default. If you’re having issues with your Google Adwords and trailing slashes missing, you may need to employ a plugin to help ensure the trailing slash is present.