To pre-populate the fields on your lead capture form, add a registrationDefault query param to the url or add leadCapture.registrationDefaults
to your Outseta Script Options.
👉 To pre-populate fields in a sign up form/embed, use auth.registrationDefaults
.
👉 To pre-populate fields in a support ticket form/embed, use support.formDefaults
.
Pre-populate with values from the URL
First, ask Outseta to "configure from querystring" by adding configureFromQuerystring: true
to your Outseta Script Options.
<!-- Outseta Script Options -->
<script>
var o_options = {
domain: '[your-domain].outseta.com',
load: 'auth,profile,nocode,leadCapture',
// ✨ Add the below configuration
configureFromQuerystring: true
};
</script>
<!-- Outseta Script (doing all the magic) -->
<script src="https://cdn.outseta.com/outseta.min.js" data-options="o_options"></script>
To prepopulate the values, add a query parameter named registrationDefaults
. It takes an encoded json object of values.
Example JSON: {"Person":{"FirstName":"Sally","Email":"[email protected]"}}
Example encoded JSON: %7B%22Person%22%3A%7B%22FirstName%22%3A%22Sally%22%2C%22Email%22%3A%22person%40domain.com%22%7D%7D
To encode the json object, you may use urlencoder.org or code:
// Example Javascript code
// The values as a JS object
const obj = { Person: { FirstName: "Sally", Email: "[email protected]" } }; // Convert the object to a JSON string const jsonString = JSON.stringify(obj); // URL encode the JSON string const encodedJsonString = encodeURIComponent(jsonString);
// Create a URL with the encoded JSON as the registerDefault query parameter
const baseUrl = "https://8ldwvr.csb.app/";
const urlWithParam = `${baseUrl}?registrationDefaults=${encodedJsonString}`;
console.log(urlWithParam);
// Result:
// https://8ldwvr.csb.app/?registrationDefaults=%7B%22Person%22%3A%7B%22FirstName%22%3A%22Sally%22%2C%22Email%22%3A%22person%40domain.com%22%7D%7D
See it in action on with defaults prepopulated.
Full demo on Code Sandbox
Pre-populate with values from leadCapture.registrationDefaults
Follow the pattern below to pre-populate a lead capture form with code. First, you'll need custom logic to get the values you want or set them statically as we do in the example code.
<script>
// Add you custom logic to populate the values
var email = "[email protected]";
var name = "Sally";
var linkedInUrl = "https://linkedin.com/in/sally";
</script>
<!-- Outseta Script Options -->
<script>
var o_options = {
domain: '[your-domain].outseta.com',
load: 'auth,profile,nocode,leadCapture',
// ✨ Add the relevant lines below to your current sites's head
leadCapture: {
registrationDefaults: {
Person: {
Email: email,
FirstName: name,
LinkedInUrl: linkedInUrl
},
}
}
};
</script>
<!-- Outseta Script (doing all the magic) -->
<script src="https://cdn.outseta.com/outseta.min.js" data-options="o_options"></script>