Passing dynamic utm codes through browser session

I would like to send visitors to a third-party quote tool as my CTA for a landing page. The challenge that I’m having is that I need to grab the utm parameters from page visit and send it through the CTA button click to the tool.

The utm information is dynamically set through Google Ads. So that the keyword and ad group of the click is recorded, and changes with each visit. This information is critical for me to understand where our sales are coming from.

Does anyone know how to do this? Or, is it even possible?

Here’s the basic workflow:

  1. The landing page receives a visit from a Google Ad click. The following utm information will be present in the browser session utm_content={adgroup}&utm_term={keyword}. (Google Ads dynamically sets the adgroup and keyword)
  2. If someone clicks on the CTA button on the landing page, I’d like to send these same utm values to the third-party tool by appending the value to the third-party url. The problem is that the values are dynamic and change with each visit. Is there a code to insert them much the same way google does with the {} field names?

Hi @SERDROHAN,
Great question, thanks for asking the Community!
I’d like to share this article that might be of interest: “Auto-populate form fields with a query string”.
Also, I have found the solution from @Pixl_Labs on this post “Passing UTM parameters to a visitor’s cookie and writing them to hidden form fields” which might help you.
I also wanted to invite a couple of subject matter experts and some of our Community Members to this conversation:
Hi @FadyAzmy, @Pixl_Labs, @JLandsman, @MHaasjes, @karstenkoehler, @franksteiner79, @PSfraga and @stefen do you have suggestions to help @SERDROHAN, please?
If anybody else has anything to add and/or share, please feel free to join in the conversation :slightly_smiling_face:
Thanks a lot and have a brilliant day!
Best,
Bérangère

Was this ever solved?

I am trying to do the same thing but everything I found, even the reply here, refers to a HubSpot form. I do not want to use a Hubspot form. I want to pass a UTM from the landing page URL to a button click to the 3rd party.

Unfortunately, I was never able to come up with a solution. I also didn’t want to use a HubSpot form, but pass the person along to a 3rd party that collects my UTMs and sends them to HubSpot via a connection. Let me know if you find a solution.

So I think you are thinking about this the wrong way.

What you are proposing is essentially ‘link decoration’ where you store the UTMs the visitor arrives with and then append them to all links that go to the third-party quote tool. It’s one way to do it, but it requires custom coding and will break often (like if you create a new page or modify something). Trust me, I’ve done it in the past and it’s a pain.

The better approach is to store the UTMs in the visitors browser (in localStorage or a first-party cookie). Then regardless of whether they fill out a form on your main marketing website or on the third-party quote tool, the UTMs from when they first landed on your site are stored and available to be passed through with the form submission.

Can you add hidden fields to the third-party quote form? If so, then you just need to write some code to pull the UTMs from storage and write them into the hidden fields. There are also tools like Attributer.io which can do all of this for you without you having to write and maintain code, but whether they work with your specific quote tool would be a question for them.