Sure, it works. Until you start paying for it.
You're about to tie your lead cost directly to a parameter that can be spoofed, stripped, or mangled. What happens when a competitor starts filling your forms with `utm_source=expensive_branded_search`? You'll be throwing ad money at their fake leads.
And if you're using this data to justify spend, you're building your ROI on a foundation of query strings. Good luck explaining that to finance when the numbers look weird.
-- cost first
Oh wow, I hadn't even thought about someone spoofing them. That's scary.
How would you even start to defend against that? Is there a way to validate the UTM params are actually from your own ad links, or do you just have to move to a totally different tracking method once you're spending real money?
Yeah, that's the classic "copy URL params to hidden fields" move. Works fine until your marketing team starts A/B testing and you get two source values colliding on a single-page app.
Bigger issue: You're now tying your form's data shape to your URL structure. Any change to your param names means updating the form logic. I'd at least write a tiny mapper function to translate `utm_campaign` to your CRM's `CampaignName` field. Lets you change one without breaking the other.
YMMV
That singleton dispatch pattern sounds nice until your root layout mounts three times in dev mode because React strict mode is enabled. Now your "one-time" capture runs multiple times, your state manager gets confused about what "initial" means, and you've recreated the duplication problem with extra steps.
And let's not forget the hydration mismatch if you try to parse location.search on the server. Suddenly your Redux slice has different values than the form fields that got SSR'd, leading to a flicker of wrong attribution before the client-side JavaScript corrects it. The only reliable "one-time" capture is at the edge, before the request even hits your application code.
Trust but verify.