Cache and utm/gclid Variables
Identifiable parameters are often attached to URL (such as
Learn more about why WP Engine sanitizes URL parameters and what to do if you have issues with URL tracking parameters.
About URL Variables
Site managers may wish to use specific URL queries, also called parameters or variables, to track how traffic is reaching a particular page. Google Analytics is one of the more common services employed to track visitors and view whether their advertising campaigns have been successful.
Tracking can be done by adding variables to the end of URLs based on the source the traffic is coming from. With Google Analytics these variables, or parameters, in the past have typically been
Here’s an example of a URL that has
utm_ variables added:
In the example above we can see the variables
utm_content have been added. In this case we’re showing a link that WP Engine shared on Facebook, so we could track traffic that came from social media to this specific blog post.
To read more about what each of these variables means in regards to tracking your site’s traffic data, check out this information from Google Analytics.
URL Variables and Cache
While most often these variables are used for tracking purposes, they sometimes might be used to actually perform an action for visitors based on the referring URL or campaign. For example, a site manager might want to display a different banner or popup for users who came to the site from different sources, or add a specific item to the cart based on a referral link. In these cases, the intended action may run into conflicts with the WP Engine server caching system.
In a normal request, adding a variable to the end of a URL will tell the server to treat the request as a brand new page, which means the entire page would be uncached and generated as completely new with each request.
NOTE: If you’re not familiar with server caching, we suggest a quick refresher from our Server Cache Guide.
Uncached requests require more server resources than cached requests meaning too many uncached requests can result in 502 or 504 errors. If you’re running a campaign using URL variables to drive traffic to your site, but all those requests are uncached, it’s a simple recipe for a server disaster. Ideally you want to have as few uncached requests on a website as possible to ensure it can scale successfully with more traffic.
In WP Engine’s cache configuration, we have specific measures in place to ensure that adding URL variables does not cause the page to serve uncached. We call this process “sanitizing”: A request is received by the server and the
gclid variables are stripped from the end of the URL before sending the request to be generated by PHP. Once the request is compiled, the variables are re-attached to the URL to be returned to the user.
If there is minimal traffic coming into the variable and it’s absolutely necessary, users can contact WP Engine Support through the User Portal to request a cache exclusion. When contacting Support, please have the following information ready:
- Environment name affected
- Example of an impacted URL
- Replication steps for the issue
- Which variable (
utm_campaign, etc.) will be added to URLs
- Approximate percentage of traffic that will be using these variables
It’s very important to understand that excluding these variables from cache could very easily cause performance issues for your site. If your site runs into issues and errors because too many uncached requests are coming in, WP Engine reserves the right to take out cache exclusions if necessary.
If a lot of your site’s traffic uses these variables, much more traffic will be uncached as the server will have to generate each request as new. This means your site will not be able to scale to support as much traffic as it would if it were taking full advantage of our caching layer.