Stripping Tags To Improve Caching Performance

Cache or CDN treat URL with parameters differently hence every click that are coming from social media in particularly paid ads such as Facebook or even Google, comes with their tracking UID append at then of URL such as fblicd or gclid.


If you ever need to remove this, here are the NGINX config.

#remove query string/s
if ($args ~* "(utm_|gclid|fbclid)") {
 #? in uri? drops the utm query string
 rewrite ^(.*)$ $uri? permanent;
}

At what expense you might ask?

You will get the speed but there’s going to be an issue with tracking.

Leave a Reply

Your email address will not be published. Required fields are marked *