Sitecore 8 – Extending Experience Profile – Part 4 – Displaying Specific Interactions Data

How to display specific interaction data

For this example, we would like to have a custom list in the Experience Profile where it listed the triggered page event when the site visitor downloaded a PDF file.

End result:

end-result-downloadedpdffiles-tab

 

How to set this up

Source code link is available at the end of this post.

How to setup a new page event

First we need to create a page event through the content editor, we can do so by going to the /sitecore/system/Settings/Analytics/Page Events

In the below screenshot I’ve created a page event called “Download PDF File”

create-page-event-downloadpdffile

 

How to assign page event to a media item

There’s a tutorial on how to this on Sitecore documentation site

I’m using a page event rather than goal for this POC because this event “download a pdf” doesn’t necessarily lead to a conversion but more about the actions that the site visitors took that we want to be aware of.

In the screenshot below I’ve assigned the pdf files in the media library with my custom page event.

assign-downloadedpdffile-pageevent-to-mediaitem

Now if there’s a site visitors that download the specified files on the website, Sitecore will trigger the page event and store the information in MongoDB which later on we will extract and display it in the Experience Profile.

How to setup the custom tab in Experience Profile

The content tree

downloadedpdffilespanel-contenttree

We define three column to be displayed on the ListControl rendering.

 

The full list of the renderings

downloadedpdffilespanel-layout

The SubPageCode rendering links to a javascript file downloadedpdffiles.js which will be executed when this item is loaded into the tab.

We can control the page size -the amount of records returned by the server-  in the GenericDataProvider properties.

How to register a new processors for the Experience Profile

Jonathan Robbin’s blog post explain it nicely on what this processors is doing.

Schema.cs

 

ConstructDownloadedPdfFilesDataTable.cs

 

PopulateDownloadedPdfFilesWithXdbData.cs

 

Register our custom processors

TC.Sitecore.ExperienceProfile.Reporting.config

notice that the sorting and paging is already built in the framework.

Register our custom result transformer

TC.Sitecore.ExperienceProfile.Client.config

 

Wire things together

As with the previous post, when the DownloadedPdfFilesPanel item is loaded we will trigger an API call to request the data to be displayed in the list control

The javascript file that’s responsible to do this is the downloadedpdffiles.js

The difference here compared to the previous post when triggering the API call is that we specify the /intel/downloadedpdffiles in the url which Sitecore recognize to be a special route. This route will try to run donwnloadedpdffiles pipelines that we define earlier in the config file.

An example of the API response

http://habitat.dev.local/sitecore/api/ao/v1/contacts/02b2e6c4-d38a-4e30-a18e-b4a31b63907d/intel/downloadedpdffiles?&pageSize=3&pageNumber=1

downloadedpdffiles-webapi-call-request

 

Source code

Source code is available in Github

One thought on “Sitecore 8 – Extending Experience Profile – Part 4 – Displaying Specific Interactions Data

Leave a Reply

Your email address will not be published. Required fields are marked *