There are some solutions available online for countdowns in (marketing) emails. Some of them are free with limitations, some of them are paid. Not very satisfying.
Here, I have created a small program that you can use on your own website to create unlimited countdowns in any way you ever like. All the files are available on my GitHub. Down here you can see the finished product. It’s in german but you can adapt it to your needs. Add other languages, add Days, Weeks and so on with a little bit of adaptation of my script. Free of charge!
The following illustration should help you understand, how the script works:
Every time the marketing email is opened by a customer, the images in there are loaded. What we do here for the countdown is that we just load a gif that shows the countdown from a certain start date. The start date will be included in the URL where we request the image from the scripts on your server, so the script on the server knows, what type of countdown to return, how far the countdown has already run down. The server returns a gif that is able to run for two minutes.
But why don’t we include just a large gif in the email with the whole countdown already in it?
Because the email would be way too large. Imagine a countdown in seconds, running for 10 days. that would mean an email with a gif that contains 864’000 separate images. You really don’t want to do that.
Furthermore, the reason why we cannot program the marketing email with a countdown can be read on this webpage.
Coming to the script I’ve created for you 🙂 It consists of 5 total files:
Main File: gifplus24hours.php
In this file, you can make changes to adapt the script to your needs. This is also the file that in the end will provide you with the gif in the email. You will be able to call it as follows:
https://EXAMPLE.COM/gifplus24hours.php?time=TIMESTAMP
EXAMPLE.COM = your website, where you upload the PHP script
TIMESTAMP = a timestamp in the following format: 2022-04-05+01:13:38
A tip for MailPoet users: You can use the following code for a timestamp in the right format: [date:custom|format:Y-m-d+H:i:s]
Also important is the file zbov74e.png, which serves as a template for the countdown gif. You can adapt it to your needs. At the moment, it’s written in German. MS Paint or Photoshop will help you in this case. Pay attention if you resize the image or change anything in the format of it that you might have to adapt the gifplus24hours.php file to the new template.
All the other files are to help create the GIF, prevent Bugs and to provide the font (the .ttf file) for the digits.
That’s all I have for you today, I hope I could help some people.