Skip to main content
Answered

Default a query string parameter when blank

  • 18 July 2024
  • 6 replies
  • 32 views

We utlize embedded typeform deployments with the following configuration:

  • Read URL parameters - True
  • Set custom values - False

The challenge we are experiencing is traffic to the form without URL parameters present. The hidden custom field values are then null. We would like to set these based on a form default if not present in the URL.

Appreciate any thoughts on this: 

Attempted solutions

  1. Set Custom Values - Fail: Because this overwrites all responses with the default values:

     

  2. Logic Steps -  Fail: Cannot utilize the replace function on a logic step only have the following options.

     

  3. Tag URL if not present - Fail: We have a script that evaluates session information and will updated cookie and optionally refresh the session with a defaulted URL. However this creates a poor user experience by trigger a second render of the page and skews traffic reporting. We have not found a way in documentation to set values based on cookie (would be cross-site/domain due to embed). 

6 replies

Userlevel 7
Badge +5

@john.desborough is definitely your variable guy!

Userlevel 7
Badge +6

@jsloan_eei @Liz - this is a new one for me.. but the way i usually suggest to do this is to leave the ‘in the wild’ forms where no values are known, with the default hidden variable string of “hidden_variable=xxxxx”   .. this allows for the target form to set the logic rules on an actual value… 

 

in your case, it seems that  you want to replace logic but can’t on the hidden variables logic. suggest use the go to page, send the user to the first question or a statement page where you should be able to then replace the text.. 

i don’t work much with embedded forms where clients send traffic from ads etc. so am probably not the best resource in this case

 

des

 

 

@john.desborough - Thank you for the suggestion. I tried the path suggested, but I don’t see in variable documentation a way to leverage a hidden value as the input for a variable. So I can set a default value for the variable (cannot call a hidden value here) via replace function if the variable is blank, but not update it to the actual hidden value if not null (see image). This is a problem because we are driving submissions to salesforce and the fields require a 1Typeform:1Salesforce Field mapping (cannot do the evaluation there). 
 

 

Userlevel 7
Badge +6

@jsloan_eei - you can’t replace the value of a variable as the value of another variable. trust me i would love that too.. 

the thought in my head was that if you use the default value of xxxxx for the hidden variable if there is not a valid product id selected to come across as the value of the hidden variable, then you could set it to what you want. 

what i created was the following:

  • hidden variable = link_id   
  • rendering the url to read:  https://desborough.typeform.com/to/BtR1Mbc8#link_id=xxxxx
  • three custom variables:
    • tow of them are ‘sub pages’ on one of my domains
      • if link_id=xxxxx redirect on completion to the About Us page 
      • otherwise go the Other Stuff page
    • one called v_text that i either show “something other than xxxxx” of the link_id variable 

and the redirect’s are set up like this:

there are two endings in my example - where i point to the same website but different pages based on the logic rules: 

 

 

i could easily set these up to be ‘redirects’ from my website to other pages as well, once the typeform logic sends them to my web site. 

 

just some workaround thoughts.. with nothing else to do this sunday afternoon other than paying bills lol.. 

 

cheers

 

dess

Userlevel 7
Badge +5

Let us know if the above answer did the trick, @jsloan_eei !

@john.desborough Thank you for the workaround suggestions. They don’t create a great user experience for the form completer. We are going to continue to try to rework the on page script to generate the query string if missing. 

It would be great if the the toggle for set custom fields didn’t default “all” or if it could be set to default all or only blank - But that is for the enhancement threads!

Best,

Reply