Solution: Today's Date Passed via Order Form

Hi Everyone,

Found a neat and simple solution to the need to capture and pass today’s date into a custom date field, to allow a campaign to test and branch based on the date. Today’s date is captured and submitted via a hidden input field in the order form.

Where StartDate is the custom field created in Infusionsoft.
Referenced via Contact0_StartDate.

All credit to StackOverflow for the solution modified for this use:

<!-- Get Today's Date and submit via a hidden field for Start Date -->
<input name="Contact0_StartDate" id="Contact0_StartDate" type="hidden" value="" />
<script type="text/javascript">
function getDate()
    var today = new Date();
    var dd = today.getDate();
    var mm = today.getMonth()+1; //January is 0!
    var yyyy = today.getFullYear();
    if(dd<10){dd='0'+dd} if(mm<10){mm='0'+mm}
    today = yyyy+""+mm+""+dd;

    document.getElementById("Contact0_StartDate").value = today;

//call getDate() when loading the page

In the order form you insert this code in the Product Area custom HTML section.

Hope this helps someone.



Hi Everyone,

A long overdue update to this solution.

Infusionsoft has a campaign option to ‘Set Field Value’ that makes setting the purchase date easier than having to use the previous Javascript solution offered.

Just update whatever custom field with whatever value you wish, in this case taking today’s date at the point in time the contact reaches this logic in the campaign (after a purchase) and updating the custom field PurchaseDate.