Collect Date Properties from Your Subscribers

read

Overview

Klaviyo can accept a custom date fields in a signup form which can take day, month, and year input values and combine them inside Klaviyo as one date property. In our example, we will walk through adding a birthday field to a signup form. This requires the following:

  1. Adding Birthday as a value in your form's $fields hidden input.
  2. Adding a block of code to your form for the date input selectors.

This guide walks through these two steps, and then covers using the Birthday field in Klaviyo.

Note

Check out our guide on adding custom fields for a general overview of adding custom fields.

Add Birthday as a $fields Value

The first step is to add the "Birthday" value to the $fields input of your form. If you already have a value here, you can add Birthday as well, and separate the two with a comma. If this input doesn't exist, you can add it right after the hidden input with your list ID.

<input type="hidden" name="$fields" value="Birthday">

Add Birthday Selector Fields to Your Form

Next, add the code below inside your form to add the birthday selectors. Note that the value for birthday_month options must be integers, but the label for those values can be text.

<div class="klaviyo_field_group select-date-widget">
 <label for="klaviyo_birthday_controls">Birthday</label>
 <div class="klaviyo_birthday_controls">
    <select name="Birthday_month" >
      <option value="1">January</option>
      <option value="2">February</option>
      <option value="3">March</option>
      <option value="4">April</option>
      <option value="5">May</option>
      <option value="6">June</option>
      <option value="7">July</option>
      <option value="8">August</option>
      <option value="9">September</option>
      <option value="10">October</option>
      <option value="11">November</option>
      <option value="12">December</option>
   </select>
   <select name="Birthday_day" >
     <option value=""> </option>
     <option value="1">1</option>
     <option value="2">2</option>
     <option value="3">3</option>
     <option value="4">4</option>
     <option value="5">5</option>
     <option value="6">6</option>
     <option value="7">7</option>
     <option value="8">8</option>
     <option value="9">9</option>
     <option value="10">10</option>
     <option value="11">11</option>
     <option value="12">12</option>
     <option value="13">13</option>
     <option value="14">14</option>
     <option value="15">15</option>
     <option value="16">16</option>
     <option value="17">17</option>
     <option value="18">18</option>
     <option value="19">19</option>
     <option value="20">20</option>
     <option value="21">21</option>
     <option value="22">22</option>
     <option value="23">23</option>
     <option value="24">24</option>
     <option value="25">25</option>
     <option value="26">26</option>
     <option value="27">27</option>
     <option value="28">28</option>
     <option value="29">29</option>
     <option value="30">30</option>
     <option value="31">31</option>
   </select>
 <input type="hidden" name="Birthday_year" value="2015" />
 </div>
</div>

This code will collect a month and day on your form, but automatically assigns the year 2015 to the date. This is because when sending birthday emails, you will likely only need to leverage the Month and Date. 

If you would like to collect a birthday year as well, you can change the birthday_year input to a select element with the years you want to use as options. Adding a year selector is not important for Klaviyo, as when you create a segment for someone's current birthday Klaviyo will only look at the month and day, but if you would like to collect a subscribers birthday year as well you can. To update the above code so that a subscriber can select a year, you can replace the hidden Birthday_year line of code with this:

<select name="Birthday_year" >  
   <option value=""></option>  
   <option value="2015">2015</option> 
</select>

This will give the options of no value or 2015. To add more year options, it will look like this:
<option value="2015">2015</option> fields for the years that you want to allow subscribers to choose from.

<select name="Birthday_year" >  
​   <option value=""></option>  
   <option value="1990">1990</option>
   <option value="1991">1991</option>
   <option value="1992">1992</option>
   <option value="1993">1993</option>
   <option value="XXXX">XXXX</option>
</select>

Alternative: Collect Birthdays Using a Subscribe/Manage Preferences Page

A less technical option is to add a date field to your subscribe page for a given list. This, in turn, will also be reflected on the list's manage preferences page.

Please note that if you use this method, subscribers must input their birthdays in the MM/DD/YYYY format in order for Klaviyo to recognize the value as a date. For this reason, it's important that you include help text to make sure subscribers are informed.

image__1_.png

If you want to follow up with subscribers after they first sign up to ask for their birthday information, you can insert a manage preferences tag into your welcome series email. In order to do this, you will need to update the subscribe page that is attached to the same list as your signup form.

Using a Date Field in Klaviyo

If your form is properly configured to collect date information, when your form is submitted, these two dates will be combined into one field. This field will be added to Klaviyo as a custom property and added to each subscriber's Klaviyo profile. 

Learn More

Learn how to set up a Date Property based flow.

Was this article helpful?
7 out of 9 found this helpful