All Collections
Iterable
Iterable - Handlebars personalization with data feeds
Iterable - Handlebars personalization with data feeds

How to add those ever-important fields to your data feed

Updated over a week ago

Iterable has a very tidy solution for using Handlebars personalization fields within data feeds. This may go without saying but at the risk of being pedantic, you'll need to ensure you've first read our article on setting up a data feed for what we're about to show you to make sense.

The three parameters

With a data feed set up, you'll need to add a few parameters to the URL that calls Phrasee for each Handlebars personalization field you may use throughout the lifespan of the data feed.

The three parameters you'll need for each field are:

  • replacer_variable - The variable in the Phrasee language variant for which Iterable will search. You must URL encode the brackets for this variable.

  • replacer_value - Iterable will use this to replace what it finds from your replacer_variable.

  • replacer_default - This is the value Iterable will use if it doesn't find any data to display from the personalization field you've selected.

Appending the parameters

Once you understand what each of those parameters is going to be used for, it becomes quite straightforward to decide what they need to contain.

You'll need to attach these to the URL field in the Edit data feed wizard.

As an example, let's say we wanted to use an Iterable Handlebars personalization field in our Phrasee variant called firstName.

We would need to configure our data feed URL to contain the following parameters:

&replacer_variable=%7b%7bfirstName%7d%7d&replacer_value={{firstName}}&replacer_default=Supporter

Notice how the brackets for the replacer_variable have been URL encoded. If they are not URL encoded, Iterable will process the personalization field and then be unable to find the processed data in the Phrasee variant.

The replacer_value has then been added as you normally would add a personalization field to Iterable.

Finally, the replacer_default has been populated as Supporter. This will be used in case Iterable is unable to find any data in the firstName field for any subscriber in particular.

When added to our data feed URL, our example becomes:

https://realtime.phrasee.co/live/single_variant?campaign_id=633ef4e719717b0007555ef4&delivery_id={{campaignId}}&recipient_id={{#urlEncode}}{{email}}{{/urlEncode}}&replacer_variable=%7b%7bfirstName%7d%7d&replacer_value={{firstName}}&replacer_default=Supporter

Multiple personalization fields

If you're interested in using more than one personalization field in your Phrasee variants, you can simply append another trio of parameters to the data URL as in the below example:

https://realtime.phrasee.co/live/single_variant?campaign_id=633ef4e719717b0007555ef4&delivery_id={{campaignId}}&recipient_id={{#urlEncode}}{{email}}{{/urlEncode}}&replacer_variable=%7b%7bfirstName%7d%7d&replacer_value={{firstName}}&replacer_default=Supporter&replacer_variable=%7b%7bproduct%7d%7d&replacer_value={{product}}&replacer_default=Product

Ultimately, you can add as many personalization fields as you like.

Using helpers with data feeds

If you need to use helpers on any of personalization fields, you can do that as you normally would in the replacer_value parameter.

For example, let's say we wanted to ensure the first letter of every firstName is capitalized. We can simply add capitalizeFirst to our replacer_value just as we would in any other Iterable Handlebars use case.

See our example below:

https://realtime.phrasee.co/live/single_variant?campaign_id=633ef4e719717b0007555ef4&delivery_id={{campaignId}}&recipient_id={{#urlEncode}}{{email}}{{/urlEncode}}&replacer_variable=%7b%7bfirstName%7d%7d&replacer_value={{capitalizeFirst firstName}}&replacer_default=Supporter

To learn more about how to use Handlebars and helpers to personalize content, check out Iterable's personalization with Handlebars documentation.

Did this answer your question?