What are utm_ and gclid_ Variables?
Site Managers will often use Google Analytics to track visitors and view whether their advertising campaigns have been successful. This tracking is sometimes done by adding variables to the end of URLs based on the source the traffic is coming from. With Google Analytics, these most often end up being utm_ and gclid_ variables. Here’s an example of a URL which has utm_ variables added:
In the example above we can see the variables utm_medium, utm_source, utm_campaign, and utm_content have been added. In this case, this was a link that WP Engine shared on Facebook, so we could track traffic 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.
Variables and Caching
While most often these variables are used for tracking purposes, they sometimes might be used to 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. In these cases, the intended action may sometimes run into conflicts with our caching system.
Normally when adding a variable to the end of a URL, a web server treats the request as a new page, which means the request would be uncached and generated as new with each request. In WP Engine’s cache configuration, we have specific measures in place to ensure that adding these utm_ and gclid_ variables does not cause a large number of uncached requests on your site, which can lead to performance issues.
This means that in our server setup, the request is received by the server and the 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 served to the user.
If this is the case, Site Managers can contact WP Engine Support through the User Portal to request a cache exclusion for the needed variables. When contacting Support, please have the following information ready:
- Install name affected
- Example of an affected URL
- Replication steps for the issue
- Which variables will be added to URLs
- Approximate percentage of traffic using these variables
It’s very important, if you do run into conflicts, to understand that excluding these variables from cache could very easily cause performance issues for your site. 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.