A variation feed enables you to automate the process of creating, editing, and removing variations. You select a template, and connect it to a CSV or XML file with the variations metadata (images, titles, and so on). Whenever the file changes – the variations change as well.
Step 1: Design your template
- Create a template for the variations.
- Create variables: Turn every part of the template that you want to be populated by the variation feed into a variable. For example, if you want the image to be different for every variation, and the image URL is in the variation feed – make the image SRC a variable.
Step 2: Prepare the file
The file can be a CSV or XML file. You can either upload the file to Dynamic Yield or host it on your server. Structure the file as follows:
- Each row is a variation.
- Columns are the variables. For example, if you have 3 variables for the title, image URL, and link – the file must include at least 3 columns, one for each of the variables.
- The file must have at least one column with a unique value. It can be an additional column (that is not used in any variable). This column is used for the variation name.
- Avoid using spaces or special characters in the title. If you have special characters in the table, save the file in UTF8 format.
- Files can have a maximum of 50 columns and 4,000 rows. Values must include fewer than 4,000 characters.
- Note: URLs must be encoded with HTML Entity Encoding. If your source includes URLs that are encoded differently, use the Parser Function to adapt them.
Example:
Title | Image URL | Target URL |
New summer collection | acme.com/img/summer.png | acme.com/summer |
25% off | acme.com/img/sale-banner.png | acme.com/sale |
Complete the look | acme.com/img/complete.png | acme.com/collection |
Tip: If your file is not a flat table, you can later use a parser function. This means that you can write JavaScript code to transform your source and adapt it to a flat table.
Add affinity attributes to your variation feed
You can add affinity attributes to your variation feed for use in affinity allocation in your campaigns (learn more about affinity allocation). Use the following column format:
affinity:[AFFINITY ATTRIBUTE]
For example: affinity:categories or affinity: color
You can set up to 5 values for each attribute using pipes ( | ). For example, for the attribute categories you can add shoes|sportswear|accessories and for the color attribute, purple|white.
Note: It's mandatory that any attribute you use in this feed is also defined in your product feed, or else you'll get a validation error. Validation errors appear only within the experience screen in Experience OS. For more information, see Affinity allocation in variation feed campaigns later in this article.
Example with affinity attributes:
Title | Image URL | Target URL | affinity:categories | affinity:color |
New summer collection | acme.com/img/summer.png | acme.com/summer | sportswear|dresses | purple|white |
25% off | acme.com/img/sale-banner.png | acme.com/sale | ||
Complete the look | acme.com/img/complete.png | acme.com/collection | accessories |
Step 3: Create a variation feed
- Go to Assets › Data Feeds.
- Click Add New and select Variation Feed.
- Name the feed.
- In the Feed Source field, you can do one of the following:
- Upload the file: After you connect variations to the variation feed, they update every time you replace the file.
- Paste the URL that hosts the file: Whenever the file changes, the variations change accordingly.
- In Advanced Settings:
- If the feed source is a URL on your servers, choose the sync rate.
- Use a Parser Function to adapt and manipulate the feed source, to create a simple, flat table that will be the variation feed.
- Click Preview.
- Select a column with a unique value in the Unique Key settings.
- Select a column to serve as the variation name in Variation Name Key. The variation name later appears in your reports, so make sure it's descriptive of the variation content.
Note: Make sure to select these values carefully, as you can define them only once during the creation stage of the variation feed. You can't change the values later.
- Click Save and Activate.
Tip: You can use the same feed for multiple experiences or campaigns, and add a column that is later used as a filter, and set a different filter per experience. For example, if you have promotions for mobile users and promotions for desktop users, you can have them in the same feed. Add a column named "Device", and a value of either "Mobile" or "Desktop". When you create an experience that is targeted to mobile users, you can filter rows that include the "Mobile" value in the "Device" column. The same goes for an experience that is targeted at desktop users.
Step 4: Create your campaign
- Create a campaign that contains the experience with your variations.
- When you create a new experience, in the Variation wizard step, click Syncing it with a Data Feed:
- Select the template you created in Step 1.
- In the template, select the variation feed you created in Step 3.
- In the template, map the feed columns to the template variables. You immediately see a preview of how the variation will appear if it is based on the first row of the feed.
- Choose variations:
- Decide how many (1-50) and which variations to serve.
- You can also filter rows by a value in the feed.
- Click Sync Variations. The variations are added to an experience in the campaign.
- Click Save Experience and then Save and Publish.
- You can always click Sync Settings to change the template, the variation feed, the mapping, or the filter.
That's it! Your experience is synced with the variation feed:
- When rows are added – new variations are created.
- When rows are removed – the variations are deleted.
- When values change in the variation feed – the variation changes as well.
Variations do not sync if:
- A new version of the feed source is empty (relevant if the feed is hosted on your server).
- There are no rows in the feed that matches the filters.
- Affinity attributes are defined incorrectly or are missing values.
Affinity allocation in variation feed campaigns
When you select User Affinity as your allocation method, you must then select the affinity attribute to use, and the related values in your variation feed are populated for each variation.
Important: If your affinity attributes aren't set up correctly in the variation feed, you'll get validation errors, and it's possible that the variations will become inactive and won't be served. So look out for the following issues.
The attribute name doesn't match the product feed
lf the attribute column name in the variation feed doesn't exactly match an attribute in the product feed, the value appears in the affinity dropdown but throws a validation error and can't be used.
No values for an attribute
If an attribute exists (in the example: categories) but has no values, the variation becomes inactive.
Values in variation feed and product feed don't match
If the values don't match due to an error (such as misspelling) or absence, the value isn't included in the variation. If the incorrect value is the only one in the variation, the variation becomes inactive.
Too many values defined for an attribute
Each attribute can have up to 5 values. If there are more than 5 in the file, only the first five are included in the variation.
All the variations are inactive
If none of the variations in the experience are active (for any of the given reasons), the campaign can't be activated.