It works by reading the email parameter from the page URL and inserting it into the email input field.
This is useful if:
You want to send survey links by email and auto-fill the email address for the user.
You want to simplify form completion for supporters.
How It Works
When a visitor opens the survey page with a URL like this:
https://[email protected]
The snippet automatically:
Detects the email parameter in the URL.
Finds the email input field in the survey form.
Inserts the email into that field.
Triggers the necessary input events for the platform to recognize it.
The Code Snippet
Here is the complete JavaScript snippet:
<script>
(function() {
const params = new URLSearchParams(window.location.search);
const email = params.get("email");
if (email) {
const waitForInput = () => {
const emailInput = document.querySelector('input[type="email"]');
if (emailInput) {
emailInput.value = email;
emailInput.dispatchEvent(new Event('input', {
bubbles: true
}));
} else {
setTimeout(waitForInput, 300);
}
};
waitForInput();
}
})();
</script>
How to Use It
Add this script to your survey’s page or landing page.
Send out your survey link with the email parameter attached:
https://[email protected]
If you are sending the survey via a CamBuildr email campaign, you need to use the CamBuildr email placeholder so the system inserts each recipient’s email address automatically.
Here’s how:
https://your-page-url.com?email={{ person.email }}
{{ person.email }} will automatically be replaced with the recipient’s email address when the email is sent. Every supporter will then see their own email pre-filled in the survey.