Skip to main content

Make the content of my newsletter dynamic

Info

A dynamic content in a newsletter is a content that changes depending on the subscriber. This means that the same campaign will look completely (or partially) different from another.

Here are some examples of dynamic content:

  • Display of a customization field (e.g.: name, surname, etc.)
  • Display of a personalized HTML block (ex: horoscope, personal advert, last product consulted, weather forecast of my city...)
  • Display of a complete personalized newsletter (ex : my tv program with my choice of channels)

To achieve this, Mindbaz provides you with several techniques:

  • Customization fields [[FIELD.XX]] or system [[CONF.XX]]
  • Conditional blocks and other functions
  • The include urls
  • The CONTENT blocks
  • Advertising inserts

Customization tags [[FIELD.XX]] or configuration tags [[CONF.XX]]

Customization tag

You can display the value of the fields of your subscribers with the tag [[FIELD.N]] (with N=id of the field). ex: [[FIELD.14]] to display the name of the subscriber

You can find the list of fields and their id here

Configuration tags

The configuration tags are mostly used internally to retrieve ids (campaign, sending, database...). They are written like this: [[CONF.N]] with N the number in the list below:

CONF.NConfigured fields
CONF.1Base identifier (defined during the base setup)
CONF.2Name of the web site (defined during the basic setup)
CONF.3Url of the website (defined during the basic setup)
CONF.5Campaign Id
CONF.6Segment Id
CONF.7Sending Id
CONF.8Date of generation
CONF.100Id of the sending configuration
CONF.101Name of the sending configuration
CONF.104Email of the sender
CONF.105Sender's alias
CONF.106Recipient address alias
CONF.107Reply email
CONF.108Replying address alias
CONF.111HTML header
CONF.112TXT header
CONF.113HTML footer
CONF.114TXT footer
CONF.115Unsubscribe HTML
CONF.116Unsubscribe TXT

We use them for example in our unsubscribe links:

https://unsub.mindbaz.com/?e=[[FIELD.1]]&s=[[CONF.7]]&b=[[CONF.1]]

You can use them for your own use if you want to pass parameters to your website pages (landing page, unsubscribe forms, etc.). The most frequent case is the use of the [[CONF.7]] tag (sending id) which will be necessary to count the unsubscription of a mindbaz sending (cf. webmethode Unsubscribe).

Another example is the automatic generation of the EPI (Enhanced publisher integration) parameter for tradedoubler tracking links (http://hst.tradedoubler.com/file/20649/manuals/doc/pub_epi.pdf). The values passed in this parameter are stored in the tradedoubler platform, which allows you to have mindbaz data directly in tradedoubler (base id, campaign id, subscriber id...). Very useful if you are exporting to a datamart. e.g. EPI:

epi = [[CONF.1]]-[[FIELD.0]]-[[CONF.5]]-[[CONF.7]]

Where to use them?

You can use these tags in the HTML code of the message, the TEXT version, the subject, the headers and footers of the sending configuration. They are also very useful to make dynamic a url of a tracked link.

Conditional blocks and other functions

The generation of html code uses a perl templating engine (PERL TEMPLATE TOOLKIT) which allows you to use many functions and keywords inside your HTML message. A simple example and also the most common is the use of conditional blocks [[IF ]] [[ELSE]] [[END]].

Example of a different display depending on the civility: :

Hello [[IF FIELD.13 == 'Mr' ]] Mr[[ELSE]]Mrs[[END]] [[FIELD.14]].

Example of different punctuation if the first name is filled in:

[[IF FIELD.15]] [[FIELD.15]], one thousand[[ELSE]]Thousand[[END]] euros of lots arrive with the spring

An online documentation explains all the usable keywords: http://template-toolkit.org/docs/modules/Template.html (just replace the [% %] by [[ ]] in the examples).

Here are the most useful keywords:

Example of generating a list with a foreach:

[[ users = {
tom => 'Thomas',
dick => 'Richard',
larry => 'Lawrence',
}
]]

<UL>
[[ FOREACH u IN users ]]
<LI> [[ u.key ]] : [[ u.value ]]</LI>
[[ END ]]
</UL>

Show :

  • dick : Richard
  • larry : Lawrence
  • tom : Thomas

In addition to the programming keywords, the toolkit offers many functions that can be applied to the perso or conf fields (http://template-toolkit.org/docs/manual/Filters.html).

Here are some examples:

  • Uppercase or lowercase: upper / lower [[ FIELD.14|upper]], [[ FIELD.14|lower]]
  • Capitalize the first character : ucfirst - ex ("[[ FIELD.14|ucfirst]]")
  • Replace in the string : replace
  • Delete in the string : remove
  • Remove spaces at the beginning/end of the string : trim
  • Format a date : date.format ex : [[ date.format(FIELD.20,'%d/%m/%Y')]] to display the date of birth in dd/mm/yyyy

Here are all the date formatting codes ( * : Display depending on the local language, FR by default)

ValueReplaced byExample
%aAbbreviated weekday name *Thu
%AFull weekday name *Thursday
%bAbbreviated month name *Aug
%BFull month name *August
%dDay of the month, zero-padded (01-31)23
%hHour in 24h format (0-23)14
%HHour in 24h format (00-23)14
%IHour in 12h format (01-12)02
%jDay of the year (001-366)235
%mMonth as a decimal number (01-12)08
%MMinute (00-59)55
%pAM or PM designationPM
%SSecond (00-61)02
%wWeekday as a decimal number with Sunday as 0 (0-6)4
%YYear2001
Note

It is possible to call several functions on the same field. For example, to put the field in lower case and the first character in upper case: [[ FIELD.14 |lower |ucfirst]]

We also have some custom functions, such as :

  • Horoscope number : zodiac_num - ex : [[ FIELD.20|zodiac_num]] (return 2 for taurus)
  • Horoscope number : zodiac - ex : [[ FIELD.20|zodiac]] (return taurus)
  • Get age: age - ex : [[ FIELD.20|age]]

The include urls

In some cases, the HTML code to be generated is so complex that it is simpler to manage it on the client side. Indeed, the customer has the knowledge of his business and already has all the data to generate the HTML code of his newsletter.

This is the case, for example, for the generation of a newsletter that displays the weather of the city of each subscriber. The customer already has all the weather data updated every day and can therefore easily generate the HTML code of his newsletter.

To meet this need, Mindbaz uses the external link include system. When sending the campaign, Mindbaz calls the client's url for each email, passing it the configured parameters (e.g. the postcode of the city for which you want the weather forecast). The client's site then responds by providing the HTML code in UTF8.

The advantages of this system is to be able to quickly set up a dynamic newsletter without deporting in mindbaz all the data necessary to its construction. On the other hand, it is necessary that the called website is fast enough for the generation of the newsletter to be done quickly enough (for example, send the weather before 9am).

To create an include url, go to the page tools>urls and create a new url by choosing the type 'include'. Your url will then appear in the list of include urls in the edition page of your campaign HTML. You just have to select it to position the tag [[INC.XX]] at the right place (with XX = id of the url). You can also enter yourself the tag [[INC.XX]] at the right place in your HTML code by putting the id of your include url in the tag.

Note

If the website returns a 500 error, the message is of course not sent.

CONTENT blocks

The CONTENT blocks allow you to create dynamic HTML blocks whose displayed data comes from a key/value table stored in Mindbaz.

Let's take a concrete example of the use of CONTENT blocks: display the horoscope in 2 different HTML formats (a large one and a small one):

As input, we have the subscriber's date of birth and as output, we have 2 x 12 HTML horoscopes (2 formats x 12 zodiac signs).

We are not going to store in our key/value table all the horoscope HTML for each value of date of birth in base but only for the 12 signs. In our example, we will have to store the HTML codes for 24 different keys:

KeyValue
grd_horoscope_1HTML
grd_horoscope_2HTML
...HTML
grd_horoscope_12HTML
petit_horoscope_1HTML
petit_horoscope_2HTML
...HTML
petit_horoscope_12HTML

You can do it easily with the webservice Content.

Then, we need to automatically associate the date of birth to the right key and therefore to the right HTML code to display. To do this, the idea is to store our keys in a dynamic format that uses customization tags.

In our example, we decide on a dynamically generated key from the date of birth converted into a zodiac sign number. We get only 2 dynamic keys:

grd_horoscope_[[FIELD.20 |zodiac_num]]
petit_horoscope_[[FIELD.20 |zodiac_num]]
Note

[[FIELD.20 | zodiac_num]] applies the zodiac_num function to field 20 (date of birth) and returns the sign number between 1 and 12.

To each key, we give a name and a unique id:

IdNameKey
1large size horoscopegrd_horoscope_[[FIELD.20 |zodiac_num]]
2small size horoscopepetit_horoscope_[[FIELD.20 |zodiac_num]]

Mindbaz takes care of creating these dynamic keys for you. On your side, you just have to give a value for each possible key with the webservice.

To use your CONTENT block, you just have to use the tag [[CONTENT.ID]] with ID the unique identifier of the key. In our example, [[CONTENT.1]] will display the HTML code of the large format horoscope and [[CONTENT.2]] that of the small format.

In the Mindbaz campaign creation interface, you will find the list of available CONTENT tags in a drop-down list "Contenu" : Content on mindbaz

Here are other examples of dynamic keys:

  • LASTPDT[[FIELD.100]] : displays the HTML code of the last product consulted whose id is stored in the field 100
  • NEWS_[[ date.calc.Delta_Days(date.format(FIELD.3,'Y'), date.format(FIELD.3,'m'), date.format(FIELD.3,'d'),date.format(date.now,'Y'),date.format(date.now,'m'), date.format(date.now,'d')) ]] : displays a different html code for each sliding day since the last registration date (fld.3).

Advertising inserts

The advertising inserts are used to make the display of an advertisement dynamic within the same campaign.

An insert is defined by a tag [[ENCART.N]] with N=insert number (from 1 to 10). It is positioned in the HTML code of your campaign. The [[ENCART.N]] tags are replaced at the time of generation by an HTML code of an ad.

The idea is to be able to associate several ads in the same insert and to choose for which population they will be displayed. To do this, the population of a mindbaz campaign can be easily segmented into several (15 segments max), which allows you to choose different ads in each insert and segment.

Here is an example in the interface where a campaign with 2 inserts is segmented into 2 populations (male vs female). We could easily configure for each segment which ads to display in each insert: Pub sur mindbaz

Note

You will notice that the subject of the email is also modifiable for each segment.

With webservices, you have to use the following method: Segments_UpdateSegmentAdvertisement

At the end of your campaign, the statistics are presented to you by segment and allow a comparison of the performance of each targeted population.

Coding your campaigns with PERL

Our Mindbaz Help Center article "Coding your campaigns using PERL" discusses this topic (in French) and will take you further in using the toolkit. This article covers the main instructions with examples to illustrate them.