[How To] Capture Date/Time In Hidden Form Field

forms

#1

Form submission date and time is captured automatically by Unbounce. If you scroll over any lead record in the View Leads section of your page, you’ll see the submission date and time appear in the left hand column. On CSV exports, date/time will be the lead column.

However, this doesn’t come through as a field when the lead is emailed. If this is something you’re looking to achieve, we’ve created a quick script that’ll help you out!

With the help of some javascript, you can generate the current date/time and set it to a hidden field on your form.


How to Install in Unbounce

Click Here for Instructions

:rotating_light: WARNING: YOU ARE ENTERING DEVELOPER TERRITORY :rotating_light:
This is not an official Unbounce feature. This functionality is based entirely on third party code, and has only been tested in limited applications. Since this isn’t a supported Unbounce feature, our support team will be unable to assist if things go awry. So if you are not comfortable with HTML, Javascript and CSS, please consider consulting an experienced developer.


Step 1.

Create a hidden field. For this example let’s call it ‘Date_Submitted’.

Step 2.

Insert the script below to your javascript box

<script>
// Change the word Date_Submitted in the following line to the name of your hidden field label.
// It has to match exact label, including capitals, underscore, etc...
var inpElm = document.getElementById('Date_Submitted');                                     
var d = new Date();
var pD = d;
window.setTimeout(sD, 5000);
window.setInterval(sD, 30000);
function sD(){
inpElm.value = d;
}
sD();
</script>

Step 3.

Celebrate, 'cause you’re all done!! :gif_master:

Big ups to @Matt_Coady and @Johnny_Opao for helping stitch this together! :clap:



Want to take your Unbounce landing pages + Convertables™ to the next level?
:spinbounce: Check out the Ultimate List of Unbounce Tips, Scripts & Hacks


The Ultimate List of Unbounce Tips, Scripts & Hacks
The Ultimate List of Unbounce Tips, Scripts & Hacks
#2

I can’t say thank you enough to @Jess @Matt_Coady and @Johnny_Opao for updating this resource. I found an old community post that had some code in it that was less than perfect. I can say this ABSOLUTELY works.

The use case is primarily with clients that are trying to pull data into salesforce…

Thank you again!
Joe