Skip to main content
Question

Populating Embedded Form Fields from URL Parameters

  • January 20, 2026
  • 1 reply
  • 1 view

I’ve set up an embedded form on my site and want to pre-populate the name/email from URL parameters.

I’ve set up the following script to update the fields:

window.addEventListener('klaviyoForms', function(e) {
if (e.detail.type === 'embedOpen') {
const urlParams = new URLSearchParams(window.location.search);

const nameValue = urlParams.get('name');
if (nameValue) {
const nameField = document.querySelector('[id^="Full_Name_"]');
nameField.value = nameValue;
}

const emailValue = urlParams.get('email');
if (emailValue ) {
const emailField = document.querySelector('[id^="email_"]');
emailField.value = emailValue;
}
}
});

If I add console.log statements, I can see the fields being selected properly and the values being set. However, when I load the page, the form is still blank.

 

Does Klaviyo prevent forms from being manipulated in this way? If so, is there a “right way” to pre-populate form fields on a page?

1 reply

Byrne C
Community Manager
Forum|alt.badge.img+28
  • Community Manager
  • January 22, 2026

Hi ​@mlightner, and thanks for the question!

Pre-populating Klaviyo form fields isn’t a feature native to Klaviyo at the moment, and I’m not currently aware of a custom way to set this up with our forms. That being said, I’m not going to rule out a custom solution to this entirely. If any other community members have accomplished this or something similar, feel free to chime in!