All Collections
Email
Add dynamic content to your emails
Adding a dynamic feed to a Copernica template
Adding a dynamic feed to a Copernica template

This article describes how to create an email feed touchpoint for Copernica and how to add it to a template.

Christiaan Proper avatar
Written by Christiaan Proper
Updated over a week ago
  • Note: adding dynamic feeds are currently only available in the previous version of the touchpoint builder. You can find this option below in the current touchpoint builder.

Make sure you have a smart campaign set up where you can add the email touchpoint to. You can leave the audience targeting blank, but make sure you add the right conversion(s) to the campaign.

Create a touchpoint with the type Mail > Feed:

In the next step of creating the touchpoint, you can filter or select which content can be shown to the recipients of the email which contains the feed. Datatrics will show the most potential content to every recipient.


Next, head back to the campaign and click on "view" when hovering your cursor on the touchpoint.

You will need the code above (red arrow) later on.


Now head over to Copernica Publisher and create a template you want to add the dynamic feed to (you can do this in the section "E-mailings").

After creating your template, go to the "Style" tab and create a new XSLT named "DatatricsItem"

Paste the following code in the XSLT:
โ€‹
โ€‹

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="items">
<!-- start the items -->
<xsl:call-template name="item" />
</xsl:template>
<xsl:template name="item"> ย 
<xsl:for-each select="item">
<div class="item">
<div><span class="title"><a href="{url}"><xsl:value-of select="name" disable-output-escaping="yes" /></a></span></div>
<a href="{url}"><img src="{image}" height="100" width="100" /></a>
Van: <xsl:value-of select="original_price" disable-output-escaping="no" />
Voor: <xsl:value-of select="special_price" disable-output-escaping="no" />
<div class="description"><xsl:value-of select="description" disable-output-escaping="no" /></div>
<br/>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Now go back to the template you just created and replace the content you want to make dynamic in the template source with the following code. You need to change the <<projectid>> and <<touchpointid>> with the values of the code you got from the touchpoint you made in Datatrics (the code with the red arrow above).
โ€‹

{capture assign=feedurl}https://api.datatrics.com/1.1/Touchpoints/getContent?projectid=<<projectid>>&touchpoint=<<touchpointid>>&output=xmlitems&profileid={$profile.id}&profilesource=Copernica&limit=3{/capture}
{loadfeed feed={$feedurl} xslt="DatatricsItem" personalizable="true"}


Template before (example):

Template after (example):

That's it, you can now find the dynamic content under the "Document Example" tab. You can change the styling of the dynamic content in the XSLT "DatatricsItem" we created before. If you want to change the amount of items, change the "limit=3" in the feed URL in your template with any amount you want.

Did this answer your question?