Campaign UTM Tracking through to form
Yes, you can do something like that. I built something very similar a few months ago where I checked for a query parameter in the URL when the page loaded, created a cookie with it using the Cookies plugin so I could access it in twig, then appended that query parameter to a donation button on other pages.

Cookies: https://plugins.craftcms.com/cookies

You also need to check if the parameter has changed or disappeared, and update or replace your cookie value accordingly. Some of the code I used is below.

_layout.twig:

{# User Tracking #}
    {% if craft.app.request.getParam('s_src')|length %}
        {# If a user lands on the site with s_src in the URL, set a variable to track them throughout the site #}
        {% set s_src = craft.app.request.getParam('s_src') %}

        {# Use that variable to set a cookie, which will track them between pages #}
        &lt;script&gt;
            document.cookie = "userSrc={{ s_src }}; Path=/; expires={{ now|date_modify('+1 day')|date('l, d-M-Y H:i:s T') }}";
        &lt;/script&gt;
    {% else %}
        {# If there isn't an s_src param in the URL, clear the variable, but still define it so Craft doesn't crash #}
        {% set s_src = '' %}
    {% endif %}


content block:

{# If there's an s_src param in the URL, use that. If there isn't, check for the cookie and use that. If there isn't one, use the defaultSessionVariable #}
&lt;a href="{{ block.button.url }}{{ '?' in block.button.url == 0 ? '?' }}&amp;s_src={% if s_src|length %}{{ s_src }}{% elseif getCookie('userSrc') %}{{ getCookie('userSrc') }}{% else %}{{ block.defaultSessionVariable }}{% endif %}" class="bg-{{ block.buttonColor }} c-white btn-lg button-block" aria-label="{{ block.button.text }}" target="{{ block.button.target }}"&gt;{{ block.button.text }}&lt;/a&gt;


If you're in the UK, Europe or California, you'll need to comply with the GDPR / CCPA legislation on cookies.