You can use JSON, RSS and XML data feeds to quickly populate your email templates. If you are working with a recommendation engine service, you can use it to generate data feeds of recommended items, their prices, descriptions, product URL's and image URL's for each of your customers. This can then be used to populate an 'Product Suggestions' email template and campaign.
Note: Please specify UTF-8 as your charset when creating your data feed.
In this example, we walk you through how to create a product recommendation campaign using a JSON feed. It will feature 3 suggested items.
1. Create your data feed.
The customer previously purchased a ‘Hot Dog Halloween Outfit for Cats’. The feed will contain product information for the 3 related items including the item name, description, image URL, and price.
Here’s the JSON data:
{
"pastPurchase": "Hot Dog Halloween Outfit for Cats",
"suggestedProduct": [{
"name": "Deluxe Cat Tree",
"description": "A jungle for your favorite feline buddy",
"price": 160,
"imageUrl": "http://img-cache.cdn.gaiaonline.com/0b4be3af7262e023cce39cffa697d4cd/http://i324.photobucket.com/albums/k331/michellepaints/CC_ Cat_Tree.jpg"
},
{
"name": "Catnip Mouse Toy",
"description": "Cats go absolutely crazy for this realistic mouse toy!",
"price": 4,
"imageUrl": "http://www.crystalclearpet.com/shop/treats/images/catnip-large-mouse-11077a.jpg"
},
{
"name": "Set of 3 Furry Sticks",
"description": "Dangle this enticing toy in front of your kitty!",
"price": 5,
"imageUrl": "http://i01.i.aliimg.com/wsphoto/v1/1944996867/Freeshipping-font-b-Rabbit-b-font-font-b-Fur-b-font- Strip-Funny-Cat-Stick-Cat.jpg"
}
]
}
We’ve also created a feed for it: http://static.iterable.com/sample-data-feeds/sample_data_feed.json
You can also include merge parameters in data feed links. For example, you can use a url like http://sample-data-feeds/sample_data_feed.json{{#urlEncode}}?email={{email}}{{/urlEncode}}.This is useful for creating ‘suggested product’ email campaigns that are tailored to each user.
If feeds are created based on a userId field like so http://sample-data-feeds/sample_data_feed.json?userId={{userId}}, the userId can either be pulled from the user profile or you can include the userId field in your events track API call for the event that will trigger the email. This will insert the userId field into the data feed url to pull the right feed for each user.
Note that certain merge parameters related to the campaign itself like {{campaignId}} and {{campaignName}} will not be generated until right before the campaign is sent, so these fields may appear a blank when "Previewing with Data".
Data feed HTTP response codes and Iterable behavior:
200: Request was a success and data feed content will be used for a send.
4XX (excluding 429): Request has invalid parameters or no feed found. Will not send.
5XX or 429: Data feed server is encountering an incident or has too many requests. Will retry every 3 minutes for up to 5 times.
*For all other codes, Iterable assumes an unrecoverable error and will not send a message. Data feed requests time out after 10 seconds.
Common data feed error response codes and their meanings:
429 - Too many requests
500 - Internal service error
504 - Gateway time out
You can also check this Wikipedia article for a fuller list of HTTP status codes.
2. Add your data feed to Iterable.
To add your feed to Iterable, go to Integrations–> Data Feeds on the side menu.
3. Code your email template.
Variables that will be pulled from the data feed need to be enclosed in double brackets [[]], whereas variables that will be pulled from the user profile need to be enclosed in double curly braces {{}}.
Here is an example of a template that will pull info from both the user profile and a data feed.
Here {{firstName}} is grabbed from the user profile and [[pastPurchase]] and the [[suggestedProduct]] entries are pulled from the data feed.
4. Determine when you'd like to fetch the data.
Iterable provides 2 options for when you'd like to fetch data from the feed to populate your template:
1. Fetch the data at time of send
2. Fetch data during template design stage (before send time)
Fetching Data at Time of Send
1. Select a data feed to populate your template.
There are two options in using a data feed in your template:
In the template editor view, go to the “Advanced” tab, check the “Render template with data feed” option and select the feed you’d like to use for the template. Be sure to save the template!
2. Preview the template with data to see how it would render.
In the template editor view, select the “Preview with data” option. Enter in a subscriber’s email and choose the data feed you’d like to use to populate the fields. This will render the template with the data feed at preview time, but not at time of send. If your feed changes prior to the send, then your actual campaign will differ from the preview.
3. If your template looks good, you can use it in an email campaign.
Learn how to create a blast campaign or triggered campaign.
Fetch Data During Template Design Stage (Before Send)
1. Begin by creating a new blast or triggered campaign.
Go to Blast--> New Blast Campaign or Triggered--> New Triggered Campaign.
2. Use Template with Data Feed.
After selecting your template in step 2, click on the 'Use Template with Data Feed' button in the lower right hand corner.
3. Select the data feed of your choice.
4. Preview your template.
The template editor view will automatically show your template with the data pulled from the data feed. If it looks good, click save.
5. Launch or schedule your campaign.
Learn how to create a blast campaign or triggered campaign.
Comments
0 comments
Please sign in to leave a comment.