UTM Variables and Caching
Last Updated -
UTM variables are great for marketing teams to track how traffic comes in, but can sometimes cause issues with caching layers on the server if they’re used improperly.
Since UTM variables are made for passing unique data to the same URL, it can potentially cause caching layers to think it’s a different page that’s not already inside the cache. This means that if you have 1,000 different UTM variables all going to the same page, a standard run-of-the-mill caching layer would see it as 1,000 different pages.
To optimize the performance of your site and deliver the fastest page load times possible, Pagely’s caching layer is configured to ignore these variables. By ignoring UTM variables, the caching layer can treat a single page as it should, regardless of the variable values attached to it.
How Does Caching Impact My UTM Variables?
Pagely’s caching layer will automatically strip the UTM variables from the request. This means that regardless of what you set for a UTM variable, the page will still be delivered directly from the cache.
In the overwhelming majority of cases, the only thing you’ll notice from our configuration is a better cache hit rate. Since the server doesn’t need to generate the same page content multiple times, this results in much faster page delivery and lower server resource usage.
Simply put, ignoring UTM variables in the caching layer results in a better experience for your users and lower server costs for you. Everybody wins!
Will This Impact Google Analytics Reporting?
Caching layers only impact how your page is delivered from the server side. It has no impact on how front-end scripts operate.
Can I Disable UTM Variable Filtering?
If you need to disable UTM variable caching on your VPS or Enterprise account, we can work together to come up with a plan that works best for you. This could be something like:
- Keep specific UTM variables while caching all others.
- Cache based on the entire URL, only delivering from the cache when the full URL matches.
- Configure UTM variables to be passed to PHP while still delivering from the cache. Additional costs may be involved.
If you’re considering changes to how UTM variables are handled inside the caching layer, keep in mind that these variables have never been meant to be processed by PHP on the server side. Generally, UTM variables should never be processed on the server side.
As we’ve mentioned previously in this article, stripping UTM variables within the caching layer dramatically improves site performance.
When UTM variables are allowed to cause a cache miss, you’ll see a significant decline in performance. Because of these large performance impacts, it’s usually cheaper to make changes to the code that’s using the variables than it is to allow them in the cache, even if it requires rewriting a significant amount of code.
Overall, disabling the default UTM variable behavior is almost always a bad idea and will dramatically sacrifice your site’s performance.