I’ve often wondered How to pre-fill UpViral form fields… and I’ve finally figured it out.
Sometimes I want to have a hidden field that has some data that I want stored in my autoresponder for example.
Sometimes, I think I want to pass in someone’s email and name so the form is pre-populated (but i’m not using a one-click opt-in).
And you can have hidden fields, but I’ve only been able to fill them inside the UpViral form editor. *I probably cover that in the “Secrets to the UpViral Editor”
Now I know how. And that feels amazing.
If you want to store the data, you’ve gotta do a little work tho. First, you have to have a field in your autoresponder to receive the data. It requires a script too.
But if you just want to pre-populate UpViral form fields, you’ll need to add the script below… and you’ll need to know how to find the field ID because it is different for every UpViral campaign.
There’s a field named “txt_email” for example, but you’ll need the ID and not the name.
For example, here’s what you might think the url would be to supply the email,
https://upvir.al/135864/lp135864?&[email protected]
but this is how you need to do it:
https://upvir.al/135864/lp135864?#[email protected]
The # works with the script below
Here’s the script that needs to be added in the advanced settings (Lead Capture Page Footer codes section in Advanced settings – make sure you hit save at the top of the page)
<script> var hashParams = window.location.hash.substr(1).split('&'); // substr(1) to remove the `#` for(var i = 0; i < hashParams.length; i++){ var p = hashParams[i].split('='); document.getElementById(p[0]).value = decodeURIComponent(p[1]);; } </script>
Hopefully that’s enough to get you started. Lemme know if you have questions.