Cache and utm/gclid Variables
Identifiable parameters are often attached to URL (such as gclid
or utm
) to better track information such as referrer or visits on a website. When we see tracking parameters on a URL instead of placed with JavaScript our servers automatically sanitize the URL. This is done in order to maintain cacheability and protect the overall stability of your site.
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 utm_
and gclid
.
Here’s an example of a URL that has utm_
variables added:
https://wpestaging.qa/blog/todays-cybersecurity-landscape/”
In the example above we can see the variables 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. 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 For most tracking purposes with Google Analytics, this still allows your campaigns to be tracked properly as the code is tracked and sent to Google Analytics via JavaScript. However, if you also want to execute a specific action based on these variables, you may run into conflicts with our caching system. It’s far better to ensure that any action based on these variables is either executed with JavaScript or to use a variable of a different name (not 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: 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. NEXT STEP: Leverage browser caching with cache-control headersutm_medium
, utm_source
, utm_campaign
, and 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.
URL Variables and Cache
utm_
or 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.
Potential Conflicts
utm_
or gclid
).utm_banner
, utm_campaign
, etc.) will be added to URLs