A content feed is a file that contains your media site's content catalog (all your articles, with article metadata). It powers content recommendations, behavioral targeting based on article properties, and more.
You can only have one content feed for each Dynamic Yield media site. Use the following steps to create, upload, and synchronize a content feed to Dynamic Yield.
Creating a content feed file
Before you can upload and synchronize a Content Feed to Dynamic Yield, you need to make sure your feed file complies with size, format, and content requirements.
Content Feeds can be in CSV, JSON, or XML format. However, if the feed contains more than 200,000 items it must be in CSV format. It can be stored in any URL or local folder.
Content feed structure
The content feed must include the basic information about your articles (ID, title, URL, publish time, post type, and its categories). You can see the list of mandatory attributes in the following table, with detailed instructions (format, limitations, and so on):
Column (case sensitive) | Description |
---|---|
id | post ID |
title | post title |
url | URL that points to the article |
publish_time | Time that the post was published |
post_type | The type of post |
categories | The categories to which the post belongs to |
Custom Columns
You can also add to the feed up to 30 more columns that describe your articles. These can later be used for targeting (say, if you add "subject", you can use it to target users who enjoy reading about a particular subject, such as basketball), affinity score (for example, include subject affinity in the affinity recommendation algorithm), or set different values for different locales (say, show a translated name for customers who visit the site from France).
Guidelines:
- Custom column values must be strings, up to 1,000 characters, with no special characters.
- Custom column names can't start with '_id'.
- You can't have a custom column name 'sku'. If you include a column with this name, the feed is considered invalid.
- After you add a column, you can't remove it. You can stop using it or return empty values, but the column must be included in any future sync.
Multi-language support
For technical details, see Multi-language Support on our Developer Docs.
To support multiple languages, you can specify different values for different languages for any field. Use the format “lng:<language code>:<column name>”: “<value>”. For example, if you want to have a translation for a product name, you would create two rows for the product as follows:
"lng:en_EN:name":"White Pants"
"lng:de_DE:name":"weiße Hosen"
The language code must match the name you use in the page context. For details, see Page Context. The language code can have up to two (_) or (-) symbols between the values. For example: "lng:en_EN_X".
Because these columns are optional, blank values don't trigger errors or warnings.
You can create a total of up to 300 columns when working with multiple languages (including all mandatory, custom, and translated columns).
To learn how to target campaigns based on user locale (using the "lng" attribute), see the Multi-Language Support article.
Note: While Dynamic Yield supports feeds of up to 5 million items, there are some limitations as the size of the feed increases. Also, larger feeds experience slower synchronization as well as slower recommendation serving speed.
Syncing a content feed
- If your feed file contains more than 20,000 items, contact your Customer Success Manager to enable uploading your feed.
- Go to Assets › Data Feeds. Note that you can create only one content feed for each account.
- If you have no data feeds, start here, and click New Feed:
And then select Content Feed:
If you already have other feeds, on the Data Feeds page, click Create New and then select Content Feed from the dropdown. - Specify a feed name, and add notes or labels if desired.
- Specify the feed source by uploading the feed file or specifying a URL linking to a location where the file is stored. If you are using HTTP authentication, add the username and password to the feed URL as follows http://user:password@url.
You can combine multiple files or sources into one feed. Click Add Another Source to specify more than one file.
You can use a parser function to control how the two feed files are merged, as seen in the following example:
function parse(feed1, feed2) { var combinedFeeds = feed1.concat(feed2); return combinedFeeds; }
- You can specify how often the file is synchronized to Dynamic Yield by expanding the Advanced Settings. The larger the feed, the less frequently you are allowed to synchronize it.
You can also use an API to update the feed on demand. This option lets you add, delete, or modify entire rows or values in your data feed and synchronize it faster to Dynamic Yield. However, it requires advanced setup and technical support. Contact your Customer Success Manager for more details. -
Modify the Feed File Using a Parser Function
If the columns and values in your feed file don’t meet the requirements above, or if some other manipulation is required in order to duplicate, move around or rename values and fields, you can modify the feed using a parser function created in JavaScript. Parser functions are only supported for data feeds up to 200,000 items.
Parser functions are required for XML feeds so the feed can be converted into an array inside a JSON.
To add a parser function, go to Advanced Settings › Parser Function and enter your code.Example - Parse an XML FeedParser functions are required for XML feeds so the feed can be converted into an array inside a JSON.
function parser(data){
var products = data.items[0].item;
return products.map(function(item){
var newFeedRow = {};
for(var column in item){
newFeedRow[column] = item[column][0];
}
return newFeedRow;
});
}Example - Combine Two FeedsYou can use a parser function to combine two content feeds into one feed.
function parse(feed1, feed2) { var combinedFeeds = feed1.concat(feed2); return combinedFeeds; }
- You can view a preview of up to 100 entries of your feed including any errors or warning by clicking Preview. Click Save and Activate to proceed or Cancel to go back.
- The length of the synchronization process depends on how many items are in your feed. The synchronization usually only takes a few minutes as long as you have fewer than 250,000 items in the feed. As the feeds get larger, they typically take around 30 minutes for every 500,000 items in your feed. If the synchronization time is an issue, consider contacting your Customer Success Manager to learn about using an API to update the feed on demand instead of periodic synchronizations.
Validating synchronization status
You can verify that your feed is synchronizing successfully at any time.
- Go to Assets › Data Feeds.
- In the Last Sync Attempt column, you should see a Date Feed Synced icon and a recent date. If the icon indicates an error or warning, download the log for more details.
- In the Actions column, click the View icon . Validate that all required columns and any custom columns you have added exist and have the correct data.