By Chris Vasquez June 28, 2022Spice up your emails with simple Jinja code that generates a text rotator. The best way to keep your emails from feeling blah is to write interesting, relatable content that personally addresses the thoughts and feelings of your audience. But when you look at the broader internet, sites have all sorts of other surprising and delightful little widgets that add that little bit of magic to move an audience from liking content to loving it. A lot of people think you can’t replicate those bits of delight in an email; but at AWeber we know that’s not true. We’ve built our templating language in a way that lets you create all sorts of exciting dynamic and personalized elements for your audience. I’m going to show you how to create a horoscope that will be randomly generated for each of your subscribers whenever you send them an email. You don’t have to be a programmer to learn how to do this, it’s just a few simple lines of Jinja (that’s the templating language we use in AWeber). What are we making today?We’re going to create a horoscope for your subscribers that has two dynamic sections so your subscribers will get a randomly generated prediction with every email you include this in. The two sections are:
Here’s what it’s going to look like: Setting up your horoscope generatorTo start, pull a text element into your message (you can do this as an existing text element if you want, I just prefer to have it in its own element to make it easier to manage). Now open Source view in the text element. Write or paste the following block of text into the Source view window and hit “ok”.
When you click to preview your message, you’ll see your random horoscope. When you switch back and forth between edit and preview mode you should get a re-generated horoscope. How does this Jinja horoscope generator work?Let’s look at each of the sections of code we dropped in.
This is an array, or collection, of phrases that will fill in the first section of the sentence:
If you want to add new items that might get pulled, just add another line:
This is the array that is filled with items that randomly get pulled into the second part of the sentence:
Finally, we have the bit of code that actually defines what shows for your subscribers.
AWeber uses the Jinja “random” filter to randomly select one of the items in the “horoscopeDayType” array for each of your subscribers. That’s all there is to it! Now you know how to make an array of text and randomly show one of the items from the array in your message. And you’ve put those principles to use to build a dynamic horoscope generator. These same principles can be used to add weekly quotes, your favorite recommended links, random product recommendations, or to introduce some variety into your email introduction. In a future tutorial, I’ll show you how to make even more dynamic horoscopes that use randomly selected sentence structures to add more variety to the types of horoscopes your audience might get. from https://fatsfixedassettracking.com/email-shouldnt-be-boring-how-to-create-a-horoscope-generator-within-an-email/6888/
0 Comments
Leave a Reply. |
Digital Marketing Journals - SEO News
Digital marketing is the component of marketing that utilizes internet and online based digital technologies such as desktop computers, mobile phones and other digital media and platforms to promote products and services. Archives
April 2023
Categories |