Solved

Unsubscribe Page - Adding Additional Birthday Field

  • 21 March 2021
  • 3 replies
  • 147 views

Userlevel 1
Badge +3

Hi, 

 

I am in the process of customising my email preferences/unsubscribe page using the Klaviyo template code as a starting point.

 

 

I am wanting to add an additional field (same as the Email address/first name/last name fields) where customers can record their birthday. The code for these fields looks like this…

 

</div>
            </div>
            <div class="form-group">
               <label for="last_name" class="col-sm-3 control-label">Last Name</label>
               <div class="col-sm-9">
                  <input type="text" class="form-control" id="last_name" name="$last_name" value="{% if request.POST|lookup:'$email' %}{{ request.POST|lookup:'$last_name' }}{% else %}{{ person.last_name|default:'' }}{% endif %}" />
               </div>
            </div>

 

What elements in the above code (the Last Name field)  would I need to alter in order to have it correctly capture birthday data. 

 

Thanks

 

Scott

icon

Best answer by caroline 24 March 2021, 15:41

View original

3 replies

Userlevel 5
Badge +8

Hi @Scott S,

Can you clarify if you’re using Klaviyo’s built-in preference pages or if you are looking to custom code a preference page? Where did you get the “template code” that you’re using as a starting point?

Best,

Caroline

Userlevel 1
Badge +3

The template code is taken from this Klaviyo help page

 

https://help.klaviyo.com/hc/en-us/articles/115005077067-How-to-Custom-Code-an-Unsubscribe-or-Manage-Preferences-Page#:~:text=To%20create%20a%20custom%20unsubscribe,tmpl.

 

I am custom coding the page using the  Klaviyo hosted page functionality.

 

 

Userlevel 5
Badge +8

Hi @Scott S,

 

It should be something like this:

 

<div>
</div>
<div class="form-group">
<label for="last_name" class="col-sm-3 control-label">Last Name</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="last_name" name="$last_name" value="{% if request.POST|lookup:'$email' %}{{ request.POST|lookup:'$last_name' }}{% else %}{{ person.last_name|default:'' }}{% endif %}"/>
<br>
<label for="birthday">Birthday:</label>
<input type="date" class="form-control" id="birthday" name="$birthday" min="1950-01-01" max="2020-01-01" value="{% if request.POST|lookup:'$email' %}{{ request.POST|lookup:'$birthday' }}{% else %}{{ person.birthday|default:'' }}{% endif %}"/>
</div>
</div>

 

Best,

Caroline

Reply