Full Answer
There are two implementation routes. The first is a plugin built for server-side capture: it hooks WordPress early, reads and persists campaign data automatically, and decodes coded tokens if you use them, so you write no custom code. The second is a small amount of code in a custom plugin or functions.php, which is the right choice when you want full control over the token map and storage.
The custom approach has a fixed shape. Hook a function to an early action such as init or template_redirect so it runs before output and before redirects. In that function, read the relevant query parameters from the request, and if you use encoding, expand each short token against your lookup map into the real utm_source, utm_medium, and utm_campaign. Persist those values to the PHP session or a first-party cookie immediately, then copy them onto the WooCommerce order when checkout completes so attribution travels with the sale.
The reason timing matters this much is that everything hostile to tracking, ad blockers, ITP cookie caps, and link-tracking parameter stripping, acts on the browser after the page begins loading. Reading the parameters in an early server hook beats all of it, because the data is captured and stored before any of those mechanisms get a turn. From there your server-side events carry clean, standard UTM values to GA4 and ad platforms, and the public link can stay short and coded without your reports ever noticing the difference.