Dynamic Data Feeds

What are data feeds and what are they used for

Marek Szwed avatar
Written by Marek Szwed
Updated over a week ago

What is a data feed?

Data feeds are similar to the product feeds that most e-shops have today. It is an XML file that is structured and written according to certain rules.

Product feeds contain data (name, product description, image url, etc.) that are in a predefined structure of the service (Google Merchant). A data feed is a little different because there are no set rules for what it should contain. Thus, it offers great potential for use in practice. The only rule here is a structure and its XML syntax.

Mandatory fields

<data></data> -  Contains the whole XML doc
<item></item> - Single item

Example of a data feed

<?xml version="1.0" encoding="utf-8"?>
<data>
<item>
<email>one@ecomail.app</email>
<recommendations>Buy a Shirt</recommendations>
</item>
<item>
<email>two@ecomail.app</email>
<recommendations>Buy a Dog</recommendations>
</item>
<item>
<email>three@ecomail.app</email>
<recommendations>Buy a Book</recommendations>
</item>
</data>

In this feed, a single item contains a variant that will be shown if the condition is met within the email feed. If the field email contains the described variant, a recommendation (content) will be shown.

This feed has two elements:

<email>

<recommendations>

Each element has its own content (e.g. "Buy a shirt" ). For use in Ecomail we need to know two elements - which element we will identify and which element we want to parse into the template.

When you insert the "Dynamic Data Feed" block in the editor, you can see that we have entered these two elements. "Dynamic content identifier" (by which element we are identifying) and "Dynamic content key" (the content we want to parse).

The identifier must correspond with its field in Ecomail. Therefore if you want to identify in the data feed by a zip code, then zipcode must be filled in for the contacts.

You can use:

  • Basic field

  • Custom field

  • A preference group

How to import a dynamic data feed?

Select the "More" tab in the main menu in the application header and choose "Data Feeds". Here you add a link to a data feed (a link to an XML file that you have uploaded externally, e.g. on your website) and confirm the addition. Then synchronize the data feed using the button and refresh the page (synchronization usually takes seconds, but if the feed is bulky, the process can take longer).


Examples of using a data feed

Simple data feed

The following snippet from the data feed contains two elements:

first <country> - the country code by which we identify the contact,

and the second <branch> element, which contains the content that will be shown.

<data>
<item>
<country>CZ</country>
<branch>Dovoláte se nám na telefonním čísle +420 123456789.</branch>
</item>
<item>
<country>UK</country>
<branch>Call us at +44 7975777666 </branch>
</item>
<item>
<country>DK</country>
<branch>Ring til os på +45 11 22 33 44 </branch>
</item>
<item>
<country>DE</country>
<branch>Rufen Sie uns an unter +42454645123</branch>
</item>
</data>

If the contact will have his country filled, you can add contact information for a centre that is in his country. For example, a Czech person will receive the following:

Data feed using HTML code

The following snippet from the data feed contains two elements:

first <zip> - the postcode by which we identify the customer's location

and the second <branch> element, which contains the content that will be shown.

<item>
<zip>70200</zip>
<branch>
<![CDATA[

<table class="nl-w100" width="700" border="0" cellpadding="0" cellspacing="0">
<tr> <td align="center" bgcolor="#FFFFFF"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr>
<td align="center" class="nl-cell nl-pl10 nl-pr10" style="font-family:Open Sans, Arial, sans-serif; font-size:24px; line-height:30px; color:#003d7c;">Your closest Coffee Shop ☕ </td> </tr> </table>
</td> </tr> </table> <table width="700" class="nl-w100" border="0" cellpadding="0" cellspacing="0">
<tr> <td class="nl-cell nl-pb0 nl-pr0" style="width: 50%; vertical-align:top; padding:0 10px 0 0;">
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="nl-cell"> <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr> <td height="20" style="font-size: 1px;line-height: 1px;"></td> </tr>
<tr> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr> <td class="nl-cell nl-pl10 nl-pr10" valign="top" style="font-family:Open Sans, Arial, sans-serif; font-size:14px; line-height:17px; color:#848484;">
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="nl-cell" valign="top" style="font-family:Open Sans, Arial, sans-serif; font-size:14px; font-weight:bold; line-height:17px; color:#848484;">Address:</td>
<td style="font-family:Open Sans, Arial, sans-serif; font-size:14px; line-height:19px; color:#848484;">Yellow st. 892<br />222-02 New York City</td> </tr> <tr> <td height="10" style="font-size: 1px; line-height: 1px;"></td> </tr>
<tr> <td class="nl-cell" style="font-family:Open Sans, Arial, sans-serif; font-size:14px; font-weight:bold; line-height:17px; color:#848484;">Opening hours:</td><td style="font-family:Open Sans, Arial, sans-serif; font-size:14px; line-height:19px; color:#848484;"><strong>MO - SUN</strong> 6 AM to 5 PM</td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr>
<tr> <td height="20" style="font-size: 1px;line-height: 1px;"></td> </tr> <tr> <td class="nl-cell" align="left"> <table border="0" cellpadding="0" cellspacing="0" class="nl-tac2"> <tr> <td width="210" align="center" bgcolor="#ffffff" height="44" valign="middle" style="font-family:Open Sans, Arial, sans-serif; font-size:18px; font-weight:bold; color:#FFFFFF; padding:0 8px; border: 2px solid #f58220;"> <a target="_blank" href="https://www.google.com" style="color:#f58220; text-decoration:none;">Take me there!</a> </td> </tr> </table> </td> </tr> </table> </td>
<td width="10" class="nl-hide"></td> <td class="nl-cell nl-pb0 nl-pl10 nl-pr10" style="width: 50%; vertical-align:top;">
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td style="padding:20px 0 0;">
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center"> <a target="_blank" href="https://www.google.com/"> <img border="0" src="https://perfectdailygrind.com/wp-content/uploads/2019/02/coffee-bar.jpg" style="display: block; max-width: 300px;" alt="CoffeeShop" width="360"> </a> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table>

]]>
</branch>
</item>

The final result in your template for people whose ZIP code is for example 10001 will result in an output like this:

Did this answer your question?