How To Add Personalized Content to a Mailing

If you have a mailing built, but would like to show specific content to specific users, this can be done easily, using Konvey’s built-in custom HTML attributes functionality.

For example, perhaps you have a recurring newsletter that includes directions to your business, but you would like those directions to be based on contact profile information, like State. This is very easy to do, provided the profile field is configured to only have one value for any given state – for example ME , instead of allowing other options like Maine , me , Me. or other alternatives.

A combination of Konvey’s konvey-switch , konvey-switch-when and konvey-switch-default attributes may be used to specify content for specific states, as well s the default content to display for all those who don’t match those values (if desired).

<div konvey-switch =" contact.state ">
​   <p konvey-switch-when =" ME ">
      <!-- Maine-specific directions content here. -->
   </p>
   <p konvey-switch-when =" NH ">
      <!-- New Hampshire-specific directions content here. -->
   </p>
   <p konvey-switch-when =" VT ">
      <!-- Vermont-specific directions content here. -->
   </p>
   <p konvey-switch-default >
      <!-- Directions content here for those who don't live in Maine, New Hampshire or Vermont. -->
   </p>
</div>

The value of the konvey-switch attribute should be a Javascript expression to test against. In this case, the konvey-switch expression is the contact profile field "state." The value of each konvey-switch-when attribute should be a string of text to compare against the konvey-switch expression. Every konvey-switch element must have one or more konvey-switch-when elements nested within it, but the presence of a konvey-switch-default element is optional.

That’s it – easy as that!