Answered

Hidden Values in Full-Page VideoAsk Embed

  • 26 June 2022
  • 8 replies
  • 126 views

Userlevel 3
Badge +2
  • Sharing wisdom
  • 15 replies

Hello! (especially @Maya and @mathio )

I have a full-page embed of a Typeform that works with the JavaScript code like this:

// create widget embed
window.tf.createWidget('<form-id>', {
container: document.querySelector('#wrapper'),

// pass the data to your typeform as hidden fields
hidden: {
hidden_var_1: x,
hidden_var_2: y,
hidden_var_3: z
}
})

What is the equivalent JavaScript code in VideoAsk?

icon

Best answer by mathio 27 June 2022, 17:43

View original

8 replies

Userlevel 7
Badge +5

Hey @TMo hope you had a good weekend!

Not sure if this could help, but we do have a code snippet here for a full page embed. Just checking with the team to see if there is a JavaScript equivalent! 

Userlevel 7
Badge +5

Hello, (I am not an expert on VideoAsk, sorry) if you are referring to passing hidden fields into your VideoAsk I think you should be able to achieve this by modifying the URL in iframe src attribute.

<iframe
src="https://www.videoask.com/fn5pz0q1v#hidden_var_1=x&hidden_var_2=y&hidden_var_3=z"
...
></iframe>

 

Userlevel 3
Badge +2

Hmmm. I need to be able to dynamically pass hidden variables.

For example, we want to have a VideoAsk set up for our existing users that are logged into our website. Therefore, we do something like the following for our Typeform surveys to automatically pass user IDs and I would like to start using VideoAsk more like this too:

id = getId(); // custom function

// create widget embed
window.tf.createWidget('<form-id>', {
container: document.querySelector('#wrapper'),

// pass the data to your typeform as hidden fields
hidden: {
user_id: id
}
})

 

Userlevel 7
Badge +5

You can achieve this with some custom JavaScript like this:

<iframe id="videoask"></iframe>
<script>
const iframe = document.querySelector('#videoask')
iframe.src = `https://www.videoask.com/fn5pz0q1v#user_id=${getId()}`
</script>

 

 

Userlevel 3
Badge +2

@Grace, I have been able to make something work for my needs based on your comments and @mathio ‘s comments. FYI, I found it much nicer to add one thing to the style sheet:

    <style>
html, body {
margin: 0;
padding: 0;
height: 100%;
overflow-x: hidden;
overflow-y: hidden;
}
</style>

By setting overflow-x and overflow-y to hidden, I could get rid of that annoying and pointless scroll bar.

I am not a web developer, so I do not know if that is a robust solution, but you might want to ask your web developers to consider that in the official recommended code for a full-screen embed.

Userlevel 7
Badge +5

Hey @TMo! Can you send us the link to your website (where you embedded your videoask)? 

Userlevel 7
Badge +5

Hey @TMo 

I’ve passed this on to the developer team and they’re going to take a look and see if they can add this on to make it clearer in the full-screen embed code 🙏 thank you for flagging it! 

Userlevel 7
Badge +5

Hey @TMo Hope you’re doing well 😊

Just wanted to stop by and give an update from the team, they’re going to look at possibly implementing a toggle to switch to a full screen embed. 

They also recommended this code:

<iframe src="https://www.videoask.com/fb0jkrox5?preview" allow="camera *; microphone *; autoplay *; encrypted-media *; fullscreen *; display-capture *;" width="100%" height="100%" style="border: none;" ></iframe>

Which may or may not be useful to you, especially as I know you had already found a fix! Thought I would share just in case it’s useful anyway.

 

Reply