Answered

Pass Hidden Source Value with Embed SDK

  • 13 December 2022
  • 3 replies
  • 78 views

Hi there, 

I’m trying to pass values from cookies into typeform. I have all the steps working apart from the final one: passing values from a variable into the hidden field within typeform. 

I’m using this very simple code for this:
 

<div data-tf-widget="FY0i2jhu" data-tf-opacity="100" data-tf-inline-on-mobile data-tf-iframe-props="title=Testing HS" data-tf-hidden="hubspot_utk=,hubspot_page_name=,hubspot_page_url=" data-tf-hubspot style="width:100%;height:500px;" id="form"></div>

<!-- https://github.com/js-cookie/js-cookie -->
<!--<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>-->
<script src="//embed.typeform.com/next/embed.js"></script>
<link rel="stylesheet" href="//embed.typeform.com/next/css/widget.css" />

<script>
var source_var = "testing2"
window.tf.createWidget('FY0i2jhu', {
container: document.querySelector('#form'),
hidden: {utm_source: source_var}
})
</script>


I have utm source:
 

​​ But I cannot add hidden fields themselves: 

 

My form is on this page: https://typeform-test-897513.webflow.io/testing-typeform-hs

I’ve also tried adding it here but it doesn’t work: data-tf-hidden="hubspot_utk=,hubspot_page_name=,hubspot_page_url=,utm_source="

How can I pass utm_source value from a cookie?

Thanks

icon

Best answer by Liz 13 December 2022, 17:35

View original

3 replies

Userlevel 7
Badge +5

Hi @alexIntegration It looks like you already have the utm variables turned on in the UTM tracking, so you don’t need to add them in the hidden field section. 😀

@Liz in multi-page journey I can’t take UTMs from URL so I need to pass them on from a cookie. I have them parsed in the cookie but I can’t pass any value from a cookie to a hidden field.

For the sake of the argument, I’ve created a custom field but it still won’t pass to the typeform.



 

<div data-tf-widget="FY0i2jhu" data-tf-opacity="100" data-tf-inline-on-mobile data-tf-iframe-props="title=Testing HS" data-tf-hidden="hubspot_utk=,hubspot_page_name=,hubspot_page_url=,leadsource=" data-tf-hubspot style="width:100%;height:500px;" id="form"></div>

<!-- https://github.com/js-cookie/js-cookie -->
<!--<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>-->
<script src="//embed.typeform.com/next/embed.js"></script>
<link rel="stylesheet" href="//embed.typeform.com/next/css/widget.css" />

<script>
window.tf.createWidget("FY0i2jhu", {
container: document.querySelector('#form'),
hidden: {leadsource: "testing"}
})
</script>

Leadsource is still empty. Any thoughts on what I’m doing wrong?

Userlevel 7
Badge +5

Thanks, @alexIntegration . I’ve answered you in your other post. 

Reply