There is now a built-in way to do this
If the survey is on a CamBuildr page and you are sending the link from a CamBuildr campaign email or automated email, add the prefill link placeholder to the URL instead of using the snippet below: https://your-page-url.com?{{ var:prefill_link }}. The page then recognises the recipient without their email address travelling in the link. See Prefilling Forms in Apps.
The prefill link only works on pages hosted on CamBuildr: only CamBuildr can read the token, and it is not part of the public API, so no other website or tool can create or decode one. The snippet on this page keeps working and is still the right answer when the link is sent from somewhere other than CamBuildr.
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={{ var:email }}{{ var: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.
Note that the email editor shows a warning when an email puts person data into a link URL. The email still sends and the value is still inserted correctly — the warning is a reminder that the address is personal data, and that in a URL it can be read by the target site, its analytics and its server logs. For a CamBuildr page the prefill link at the top of this article avoids that; for any other website, the placeholder is the right choice.
