Need to prefill just email addresses that you already have? See Prefill Email Address.
Want to automatically submit the form after prefilling the fields? See Auto Submit Forms.
Prefilling fields allows you to pass data into our form without having the user enter their information. Typically you would do this if you are directing users to the campaign after they have signed into your site or completed some other type of form before seeing the ViralSweep entry form.
Using the script below, you can prefill any fields that you would like, including custom fields. Simply include this script on the page right before the actual script for the campaign style you are using (full page, widget, or lightbox).
For custom fields, you will need to add the fields to your entry form first, then visit your entry form, and using the browser inspect tool, select the field and find its ID. If you need assistance with this, please contact us.
//change widget to full or lightbox depending on which style you are using
vs_prefill_field('address','23 Main St');
vs_prefill_field('country','United States of America');
vs_prefill_field('18940_1525208752','This is a custom field example-don't copy.');
To pass dynamic values into these fields, you would simply replace the preset values with whatever values you have for the particular user that is visiting the page.
Please also note, when passing data for state and country, the data you pass must match what we have in our system (for example, if you pass USA it will not prefill, but United States of America will prefill).
URL Parameters Implementation
To prefill fields using the URL parameters implementation, you simply need to add the parameters you want to pass on the end of our provided URL. The parameters that can be used are as follows:
vs_address=1234 my street
vs_country=United States of America
A working example would use our direct link that we provide, and have any of the above parameters appended to it.
For example, our direct link is:
To append all these fields we add:
&vs_address=123 my street&vs_address2=apt
=United States of America&vs_code=1234
Our final link looks like this:
You will notice how all the fields are prefilled when visiting the above link.
We're here to help
If you have any further questions, please start a Chat. Just "Click" on the chat icon in the lower right corner to talk with our support team.