Capture GET parameters in landing and resend them in CTAs


#1

Hi !

I'm need to capture get parameters in landing pages.
ex: https://info.mysite.com/landing?utm1=foo&utm2=bar

And then be able to use these parameters in the cta URL, like this:
CTA URL: https://www.anothersite.com/sign-up?utm_1={{_get.utm1}}&utm_2={{_get.utm2}}

When clicking on this CTA on the landing called with the previous parameter should call:
https://www.anothersite.com/sign-up?utm_1=foo&utm_2=bar

Is there a way using hubspot to do this ?

Thanks,
Regards,
Thomas.


#3

Hi Thomas,

If I am understanding this request properly, I believe you can resolve this through a combination of HubL and JS.

See this code snippet I wrote:

  {% if contact.firstname %}  //browser checks to see if the visitor's firstname is known to HubSpot
    {% require_js position="footer" %}
        <script>
          window.history.pushState('meep','Title','{{ contact.firstname }}'); // visitor's firstname is appended to slug without reloading the page
        </script>
    {% end_require_js %}
  {% endif %}

Please note that you will need to include the above snippet in either a custom module in the template of a HubSpot page or in the header/footer html of a particular page.


#4

In my use case, people arriving on the landing page are not contact.
Typically they clicked on a facebook ad or a google ad.
That's why I need to pass-thru the utm parameters from the ad to my application (with landing and CTA in the middle):

This is what I need:

FacebookAD -> landingurl?utm_source=test1&utm_medium=test2&utm_campaign=test3&utm_term=test4&utm_content=test5 -> HS landing -> HS CTA -> my_website_application?utm_source=test1&utm_medium=test2&utm_campaign=test3&utm_term=test4&utm_content=test5

I need the landing / CTA to be able to capture the value of utm_xxx from the called landing url and send them back to my application when a user click on the CTA.

It's quite easy with javascript to capture the GET parameter in the landing page and store them in javascript variable.
But I did not find a way to pass the variables to the CTA (since the dest url in the CTA in the page is not yet the real destination)


#5

Update:

I found a workaround:

I writed a small redirect engine in my main website and I use the redirect url in my facebook ads.
When a user click on FB ad, he goes to my website, I store the utm parameters in cookies and redirect the user to the hubspot landing page.
When the user click on a CTA and goes (back) on my website I'm able to get back the utm cookies and store them when I need to.