Create a custom personalization token
The Email Experience Manager (EXM), you can use tokens to personalize your email campaign messages. For example, in the beginning of a message, you can use the token $name$ in the greeting so that when you send your email campaign, the token is replaced with the name in the contact.
If you want to use tokens that are not available by default, you can create a custom token that you can use for your email campaigns.
To create a custom token, you must:
Create a custom contact facet
Create a custom contact facet
In the Sitecore Experience Database, you can extend the contact with your own custom data by creating a new custom contact facet.
To create a custom contact facet:
-
Create the custom contact facet, for example, the Salutation facet, with the Title property that you want your custom personalization token to be replaced with.
Create a property for the custom facet
Create a property for the custom facet
You must create a property class to represent your custom facet. You use this property in the new processor that you create in the next section.
For example, to create a Salutation property:
Add a new processor
Add a new processor
In the <getXdbContactRecipient> pipeline, add a new processor to assign a value to the new property. For example, for the Salutation property, the value is pulled from the Salutation facet.
To add a new processor:
-
Add the following configuration file in the /Include folder:
-
Compile the following to a custom DLL:
Override the default token map
Override the default token map
Override the default implementation of the recipientPropertyTokenMap token map class that describes the bindings between tokens and properties of a contact.
To override the recipientPropertyTokenMap token map class and bind the Title token to the Salutation property:
-
Add the following configuration file in the /Include folder:
-
Compile the following code to a custom DLL:
Now, you can use the $title$ token in email messages and it will be replaced with the value that is stored for the relevant contact in the Analytics database.
If you want to import the new custom facet from a file, you can extend the Import contacts wizard to include the custom contact facet as a new mapping field.