Yes, your approach of capturing UTM parameters from the URL, storing them in cookies using custom JavaScript in GTM, and then using those values in your Google Tag settings is generally correct for single-page applications (SPAs).
However, if you're not careful, it can lead to inaccurate attribution. For example, if those cookie-stored UTM values are reused across multiple sessions, you may end up crediting conversions to an old source like Facebook or email—even if the user returned later through Google Search or organically.
This can misrepresent your traffic sources and underreport performance from channels like TikTok, organic, or direct. To avoid this, make sure you store UTM parameters only when they’re present in the URL and consider using short-lived or session-based cookies. That way, you won’t overwrite newer, more accurate traffic sources with stale data.