- Updated: Oct 24, 2017
- Audience: WhatCounts' User / Web/RSS/Syndication Teams
- Version: 1.0
The WhatCounts platform allows for the ability to use content published to an RSS feed inside of emails deployed through the platform using the RSSGet featureset. This is especially helpful in automating portions of your email content from an external source at the time of the email send.
One example may be providing the latest news from your organization’s website as a part of your newsletter email content. We will see how we can leverage the content published in our site’s RSS feed to populate content inside an email.
Here are a few things you should know:
- Most CMS platforms (WordPress, Drupal, etc.) provide basic RSS functionality when publishing new content.
- RSSGet supports a limited selection of RSS2.0 elements. Users or CMS platforms that use additional or non-standard elements may encounter limited functionality.
- Links inserted into emails through RSSGet will not be tracked in reporting.
- It is important that you understand the order in which articles and images are published within your feed. RSSGet will mirror this order.
- WhatCounts does support XSLT, for additional information consult our XSLTGet documentation.
Task Roadmap
- Defining RSS Feeds in a Template
- Inserting Text Content from a specific RSS entry
- Inserting Image Content from a specific RSS entry
- Inserting Links / URL from a specific RSS entry
- Additional Notes
Preparing To Use The Feature
- This documentation assumes you have a fundamental understanding of the basics of RSS, its terminology, and familiarity with how your organization specifically implements this tool.
- It is important to have a moderate understanding of HTML, familiarity with the WhatCounts Template Editor, and most importantly the specific content blocks and layout requirements of your specific email templates.
- It may be beneficial to identify the CMS / Website stakeholders on your team if changes to the RSS feed / elements are required.
Defining RSS Feeds
The Feed Definition tells the WhatCounts platform the URL for your RSS feed. You may include multiple feeds in your content. Note: every feed should use a unique name, even in different Templates to prevent caching issues if campaigns are running concurrently. The definition may be anywhere in the template, but we recommend placing them at the top of the template or article for easy location and editing.
Your contacts will not see the feed definition in their received emails, only the RSS content. You can confirm correct settings by using the Preview tool in the Template Editor.
A feed is defined using the following format:
%%rssfeed url=[URL] name=[NAME]%%
Where [URL] is the URL pointing to the rss feed or xml feed and [NAME] is the identification to use in other tag calls in the template. The Feed Name should be short and include no spaces or special characters.
For example, to include both the news and events feeds into our template, we would add the following to the top of the template
%%rssfeed=http://mysite.com/news.rss name=news%%
%%rssfeed=http://mysite.com/events.rss name=events%%
You are able to use any helpful word or phrase in the name portion of this command to help identify the feed it corresponds to. Now that we have defined feeds to be used inside of our template, we are able to reference a handful of RSS elements for each entry.
Element |
Description |
title |
The title of the item |
description |
The item synopsis |
content |
Content of the RSS item |
link |
The URL of the item |
pubdate |
Indicates when the item was published |
mediaimage |
Support for both <image> and <media:content url> elements inside of an RSS item The URL must be an HTTP URL. |
Now that we have defined the feeds in the template, and know what RSS elements are available, let’s look at a few examples of adding these to a template.
Inserting Text Content from a specific RSS entry
Working from the RSS Feeds we referenced previously:
%%rssfeed=http://mysite.com/news.rss name=news%%
%%rssfeed=http://mysite.com/events.rss name=events%%
We can easily reference the title of the first item in the News feed using the RSSObject command, using the same %%rssfeed NAME.element #%% syntax described above
%%rssobject yourfeed.title 1%% (the title of the first item in the yourfeed feed)
Note the numeral 1 at the end of the command corresponds to the first item in the http://mysite.com/news.rss feed, we can reference the second, third, or any other item within the feed by changing the number at the end of the RSSObject command inside of a template. Additionally, we can reference any available element for the item. See some additional examples below
%%rssobject news.title 2%% (the title of the second item in the news feed)
%%rssobject events.description 1%% (the description of the first item in the events feed)
%%rssobject yourrss.pubdate 3%% (the publication date of the third item in the yourrss feed)
Note: You can use the RSSObject command in the Subject line as well as the body of your emails to allow for further use of dynamic content.
Inserting Image Content from a Specific RSS entry
Same as working with text, we can pull images from an RSS feed by referencing the mediaimage element in our RSSObject command. Let’s again look at a few examples using the news and events feeds we used in the previous examples:
%%rssfeed=http://mysite.com/news.rss name=news%%
%%rssfeed=http://mysite.com/events.rss name=events%%
We will still need to utilize the HTML <img> tag to add images to our Template, however we can use the RSS command in place of the normal image path, let’s take a look at how this works.
<img src=”%%rssobject news.mediaimage 1%%”> (the image corresponding to the first item in the news feed)
Inserting Links / URL from a specific RSS entry
Similar to the image example, we can use the RSSObject command inside of anchor tags placed in your HTML template, allowing links to be generated from your RSS items.
<a href=”%%rssobject news.link 1%%”>Read The Latest Article</a>
Note: links from RSS used in a template will not contain any tracking information and subsequently will not be appear in any WhatCounts generated reporting.
Additional Notes [Advanced]
Below, we have provided a few additional use-cases for more advanced users. Having a basic understanding of programming concepts is recommended before implementing the following. Additional documentation on these topics is available in the Learning Center.
Checking RSS Feed Is Valid
If you have a template calling in an RSS feed, you may occasionally run into an issue where the Feed is missing, and want to display an alternate message if no updates are available. To account for this, set the feed to a variable, shown in the first command, and then test if the variable is blank, demonstrated on the following line:
%%set rssContentTester = {{rssobject news.content 1}}%%
%%if rssContentTester == "" then print "There is no new content at this time." else print "##$rssContentTester##"%%