0 Comments

In my previous post, I explained how to create custom facets and store them in xDB. In this post, I’m going to show you how to display custom facets in Experience Profile.

Experience profile lets you monitor the behaviour of contacts that have interacted with the website. It allows you to search a specific contact, either via either name or email. 

If you click on the contact, then you will be able to view the contact profile as shown in below.  This is cool right?!, however, you may find that Sitecore does not automatically display custom facets. 

image

In order to to achieve this, custom code is required. Therefore, I’m going to show you how to create a custom tab in the contact profile and display custom facets step by step.

STEPOne – Create custom facets

In my previous post, I’ve created a newsletter subscriptions facets and stored in xDB.

image

However, creating custom facets is not the scope of this post, if you want to learn how to create custom facets, you can refer to my previous post here.

STEP Two – Create Web API for retrieving the facets by contact id

This is much like any other WebAPI you will have created, and I would recommend applying access restrictions to the API for security reasons, you can apply Sitecore’s existing security filter called AuthorizedReportingUserFilteruse, which is defined in Sitecore.Cintel.dll.

Here is an example code:

 

Once you complete the implementation of your API, the next step is to register the API in route.

image

 

STEPThree – Create SPEAK script; this will call our API

  • Firstly, I’m going to create a folder called “Subscriptions” under /sitecore/shell/client/Applications/ExperienceProfile/Contact/Subsriptions
  • Next, I will add subscriptionsTab.js and subscriptionsTab.css under the folder. (as shown as below)

image

  • Associate the created CSS in core database

you will need to add style item in core database and point at the css file.  The defined css will be loaded automatically, when contact profile page is loading.

image

  • Associate the created JavaScript in core database

In this step, I created a new custom Tab, called “SubscriptionPanel” and PageCodeScriptFileName is where you should associate with the JavaScript we just created above.

 image

In order to verify what you’ve done so far is correct.  you should be able to see the new custom tab “Subscription”, and  both subscriptionsTab.js and subscriptionsTab.css are loaded, after contact profile page is loaded.

image

The next step is to write a script for retrieving the data via the custom API you created above. Sitecore use SPEAK as a framework for developing Sitecore application with a consistent interface.  The syntax is very simple to follow and extend.

Here is the sample code for calling the API and return Json.

STEPFour – Binding Json object to the controller on the custom Tab

The last step is to display the Json data on the custom Tab.

In the above code snippet,  you will find this code cintelUtil.setText($that.WhatsOnValue, jsondata.WhatsOn, true);.  this sets TextBox “WhatsOnValue” within the controller, so it contains the Json value.  Then, the next question is how to define the “WhatsOnValue” textbox in Sitecore?  Don’t fret, I will show you how this can be done!.

  • Add Text rendering (Note: because I’m using SPEAK 1.1 framework,  I will have to select the Text rendering under SPEAK 1-1)

image 

  • Set the ID to “WhatsOnValue”, this is the ID where the cintelUtil.setTextto function is referring to.

image

Congratulation!! you’ve done all the code and configuration.  Now let’s check out the result,  The “subscriptions” tab should display in the contact profile page as well as the custom facets associating with the contact.

image

Hope you found this post is useful, and enjoyed this article.

0 Comments

image

If you are using the latest EMX 3.4, you may already know that Sitecore replaced their MTA with Sparkpost.  In previous versions,  you would need to have Sitecore Application Centre credentials and an MTA subscribed Sitecore licence before you start to use Sitecores MTA. 

Now, you no longer need to access the Sitecore Application Centre as Sitecore is fully integrated with Sparkpost for EXM 3.4. Further more DKIM (DomainKeys Identified Mail) has been implement within EXM.

 

What is DKIM?

DKIM lets an organization take responsibility for a message that is in transit.  The organization is a handler of the message, either as its originator or as an intermediary. Their reputation is the basis for evaluating whether to trust the message for further handling, such as delivery.

Technically DKIM provides a method for validating a domain name identity that is associated with a message through cryptographic authentication. So instead of passing user name and password to SMTP server, it passes an encrypted key to the mail server.  This helps to keep your email campaigns out of spam folders and it ensures that others cannot use your domain without permission.

You can read more about DKIM here

 

How to configure DKIM in Sitecore?

Firstly, you will need to add domain. Purpose of adding each domain is to validate the domains that you want to use to send email campaigns. This domain is not registered within the MTA, but instead Sitecore validates the sending domain by DKIM (DomainKeys Identified Mail).

image

 

Secondly,  add the TXT records in DNS configuration.

The method of adding TXT record differs in different hosting environments, however it is as simple as adding a recording of type 'TXT' and providing the "Hostname" and "Value" i.e. a DKIM key. For more information on these records, please check this link.

Changes to domain records can take up to 24 hours to take affect.

image

If the hostname and key are valid, you should see a green tick; as per the below screen shot.

image

 

Last but not least,  you need to disable the custom SMTP configuration and enable Sparkpost configuration. This can be done by removing the suffix .disabled from the following files:

  • Sitecore.EDS.Providers.Sparkpost.config.disabled
  • Sitecore.EDS.Providers.Sparkpost.Sync.config.disabled
  • Sitecore.EDS.SparkPost.Client.config.disabled

 

Do I have to configure DKIM for different environments?

No.  Once the domain has been added against your Sitecore licence (within EXM), it will take affect for all instances using this license, regardless of the environment i.e. UAT, Production etc.

 

How to verify it’s working? 

EXM will validate the “from email” based on the domains that you registered.

image

Alternatively you can use the “Review” option and send a quick test. If all the everything is correct, you should see a message successfully sent message at the top of the page.

image