💡 Email Design Tip - Using The Date Variable with a Dynamic Coupon

  • 22 June 2021
  • 4 replies
  • 1229 views

Userlevel 7
Badge +38

Hey Fam, 

 

This tip is a “nice-to-have” to help the user experience in the welcome flow that uses a dynamic coupon which expires after X amount of days.

 

I’d say 99% of brands are using an welcome discount to incentivize visitors to get on their email list.  So, naturally, that first email should answer the question - what’s my coupon code?!

 

Yes, you could use a static coupon that’s the same for all your subscribers (ie. WELCOME15), but a few issues I have with that:

  1. It could be EASILY shared amongst friends (I’ve done it) and found by services like Honey
  2. If you want to incentivize urgency, will someone believe a generic coupon code is actually going to expire (yes, my view is skewed because this is what we do for a living)
  3. Does it really make the subscriber feel special that it’s a code really for them? Probably not

Okay, so what’s the tip?

Here’s our setup:

  • Dynamic code generated by Klaviyo
  • Expires after X amount of days (let’s say 7)
  • Reminder email after 6 days that the coupon will expire

Almost everyone reads that first email.  The 6th day email, not so much. Then we started getting messages that people didn’t know it expired on “June 5th”.

 

Now, we had “code expires in 7 days” on that first email, but that may be too much work for the customer to figure out what day it was.  Instead, we used the Klaviyo date variable to show which day it actually expires. 

 

Here’s what it looks like (and that date is dynamic!)

Shows the date the code expires

 

Here’s the code that takes care of it (snippet from a Klaviyo help article):

 

Calculating a future date

If you’d like to display a future date relative to the day a message is sent, apply the days_later filter to the today variable outlined above, like this: 

{% today "%Y-%m-%d" as today %} {{ today|days_later:5 }}

This variable will display the date five days after a message is sent. So, if the message was sent on March 18, the date displayed would be 2021-03-23. 

This filter can be combined with the formatting filters outlined above to use a different date format. Take this code as an example: 

{% today '%Y-%m-%d' as today %} {{ today|days_later:15|format_date_string|date:'M d' }}

If the message was sent on March 18, this would render as Mar 23. 

 

Some would say it doesn’t matter to have the code expire, since you’ll most likely give to a first time customer anyways (and we always will).  But, what it does is to train your subscriber to BELIEVE what you say in your emails.  So, when you do actually have an offer that expires, they know to have some urgency on it. 

 

If you’re using the date variable in any other ways, would love to see some examples in the comments or DM me!


4 replies

Badge +2

 

Calculating a future date

If you’d like to display a future date relative to the day a message is sent, apply the days_later filter to the today variable outlined above, like this: 

{% today "%Y-%m-%d" as today %} {{ today|days_later:5 }}

This variable will display the date five days after a message is sent. So, if the message was sent on March 18, the date displayed would be 2021-03-23. 

This filter can be combined with the formatting filters outlined above to use a different date format. Take this code as an example: 

{% today '%Y-%m-%d' as today %} {{ today|days_later:15|format_date_string|date:'M d' }}

If the message was sent on March 18, this would render as Mar 23. 

 

Some would say it doesn’t matter to have the code expire, since you’ll most likely give to a first time customer anyways (and we always will).  But, what it does is to train your subscriber to BELIEVE what you say in your emails.  So, when you do actually have an offer that expires, they know to have some urgency on it. 

 

If you’re using the date variable in any other ways, would love to see some examples in the comments or DM me!

 

Hi @Mailbox Manny,

 

The “Calculate Future Date” method is a great feature! I am looking to slightly tailor it for my own templates and I could use some of your help. 

 

I have a custom property called ‘Free Baby Essentials Class Date’ with a DateTime formatted value of ‘2022-02-12T09:30:00Z’. This represents the date and start-time of a class that I am running. 

 

The class is two hours long, starting from 09:30 (as per the custom property) and running till 11:30. I would like to show the end time in my email template. 

 

My thinking is that it’s possible to follow the method you described above but apply it to the Time section of the DateTime property instead of the date section. Is this possible? 

 

What I need the recipient to see is:

Start Time: 09:30

End Time: 11:30 

 

Would it look something like this?:

Start Time: {{ person|lookup:'Free Baby Essentials Class Date'|format_date_string|date:'H:iA' }}

 

End Time: 

{% Free Baby Essentials Class Date '%Y-%m-%d %HH:%MM:%SS' as Free Baby Essentials Class Date %} {{ Free Baby Essentials Class Date|hours_later:2|format_date_string|date:'H:iA' }}

 

Thanks for the help!

Phil

Userlevel 7
Badge +38

Hi @happybabyclass, great question.  I haven’t come across a scenario where we needed to add the time in there yet. 

 

I’m very curious to see how this works now, but before I try it out, did you happen to test it yet?  The best way to see if it works is just to go in there and start playing around with it :) 

Badge +2

Hey @Mailbox Manny

Thank you for the reply! Yeah, so I tested it, and unfortunately, I was unable to make it work. 

 

Klaviyo seemed to not even allow me to save/parse the text box that the end time function was in. I can’t seem to find any information to help me on the Django forms either.

 

I've currently resorted to just writing the class length in hours underneath the start time so it isn't the end of the world but the solution I am imagining would be a nice touch! 

 

Thanks, 

Phil 

 

 

Userlevel 7
Badge +60

Hey @Mailbox Manny and @happybabyclass,

Loving the collaboration! To shed some more light on this topic, although Klaviyo supports the use of a |days_later: variable filter, the same cannot be said for an “hours later” function. 

In addition to the work around you’ve come up with, an additional solution would be leveraging the show/hide function. Using this function is similar to an “if/elseif” statement where you can allow a certain block to appear based on a user’s existing profile property or event data. For example, you can set your block to only display to a recipient who has the “Free Baby Essentials Class Date” custom profile property which would display the start and end time of the class. 

This sort of use case has been mentioned before in some previously Community posts which I’ve included below for more reading. I also believe taking a look at the Glossary of Variable Filters would be helpful to see what other variables filters are available.

I hope this helps!

David

Reply