Monday, February 13, 2017

Custom Experience Analytics Reports

Sitecore has really cool features to implement. One of them is creating custom reports in the Experience Analytics Dashboard. Sometimes, customers need to know essential information in order to improve their website.

In order to improve the website content and words used in its pages (SEO), the customer needs to know what are the most used words in the site search. Therefore, I am going to walk you through the steps to track the words used in the site search and creating a report that displays those words and how many times are they being searched for.

By default, the internal search keywords are not being tracked in Sitecore. Therefore, in order to track them, appropriate search event should be registered when the search occurs.

Following code should be added when the user searches for a word in the site, and hits submit:



The above code means that the search keyword is being tracked and saved in Interactions table in the analytics mongoDB:


The data then gets aggregated to the “Fact_SiteSearches” table in the Analytics database in SQL.
We’re almost there! All what we have to do now is to create a custom report in the Experience Analytics Dashboard to show the words and their count.

To create a report page, you should do the following:
  1. You should have Sitecore rocks installed and a connection created to your website.
  2. Navigate to the core database in the website content tree using the following path: core/sitecore/client/Applications/ExperienceAnalytics/Dashboard
  3. Right click on any report category (for example Aquisition), and click on Add – New Item.
  4. Select the “ExperienceAnalyticsReportPage” template, and enter a term (recommended to start with “experienceanalytics”).
  5. Click Ok.
  6. There will be PageSettings created by default under the report item you just created.

Now, we have to choose a chart component to the report created. In order to do so, follow the below steps:
  1. In Sitecore Rocks, right click on the report page item you created, and click on Tasks – Design Layout.
  2. In the Design Layout, click on Add Rendering.
  3. In the dialog box, select a chart control to use for your report (Example: select an “ExperienceAnalyticsBarChart” if you want to display a bar chart).
  4. Click Ok after choosing the rendering you want.

After that, you need to add a parameters item to configure the report metrics (which will be “Count” in our example):
  1. Right click on the PageSettings item that is under the report item that you created and click Add- New Item.
  2. We will have to choose the “ExperienceAnalyticsBarChart Parameters” since that we chose the “ExperienceAnalyticsBarChart” rendering.
  3. Enter a proper name for it and hit Ok.
  4. Double click on the new parameter that you added in order to configure the metrics there.
  5. Choose the “Count” option from the “metrics” field and hit save.

Last step we should do is to bind the bar chart we created with the parameters item that we added. This is done by doing the following:
  1. Right click on the report item and choose Task - Design Layout.
  2. Double click the chart item “ExperienceAnalyticsBarChart control”. In the Edit Rendering Properties box – Behaviour – Datasource, browse the location of the parameter you created.
  3. Click Ok.

We are done now! You can go the Experience Analytics dashboard to check the report you created:


Note: The data is being displayed from the view that is in the Analytics database (dbo.SiteSearches)

Happy Sitecore Coding!


No comments:

Post a Comment