6

For one of our implementations we came up with the (relatively simple) following requirement:

Let's show a 'Other people also viewed' kind of functional block on our content / product and other page (where relevant).

This block should leverage the analytics information collected from previous users and visitors. As this is basically a part of the functionality that the Path Analyzer holds, worst case I need to dive into that code.

I had hoped to find some actual examples, API information but seem to find very little to nothing on this topic.

As XConnect will handle this type of requests against the Analytics reporting and MongoDB in my opinion, it might very well be that this information gets obsolete very quickly.

So my questions:

  • What is best used to retrieve information out of the Sitecore Analytics at this point? API or custom written queries?
  • Anyone who can guide me to some good documentation anywhere?
  • Actual examples or ideas to implement the requirement listed above would obviously be welcome.

PS, Sitecore version 8 and onwards.

  • this is a very good question. looks like the only way to do it is to decompile the path analyzer app and use its inner api for individual purposes. – Andrey Bobrov Jan 13 '17 at 11:16
  • Sure hope not, as one would expect that when development of the Path Analyzer is done, they would think of providing the written code into re-usable API classes for later use. – Kris Verheire Jan 13 '17 at 14:14
  • of course, there should be reusable classes. if I were you, I would start from basic ajax requests that speak app makes in order to fetch historical data – Andrey Bobrov Jan 13 '17 at 14:58
1

This answer is not an implementation of your requirement, but rather a direction of where to start from.

I have disassembled the Sitecore.PathAnalyzer.Services.dll assembly and found that there are basically two services used in the PathsController for building the path:

ITreeService _treeService;
IPathSetBuilder _pathSetBuilder;

And they are used as follows:

public PathSet Get(PathRequest request)
    {
      NodeAdapter tree = this._treeService.GetTree((TreeRequest) request);
      return this._pathSetBuilder.Build(request.ItemId.Value, tree);
    }

Below are the essential parts of the PathRequest parameters that you will require to pass to the TreeService and PathSetBuilder in order to build a path:

new PathRequest {
    ItemId = this is an id of the context item for your query
    TreeDefinitionId = this is a map definition item, 
                    i.e. {68E713D8-A382-4378-8FB0-9D7F7AD14B25} is All Site Experience
    StartDate = Start date to aggregate data from
    EndDate = End date
}

  1. This is just to give a basic idea of using the path analyzer's api
  2. You can study the parameters better by checking your chrome console for {root}/sitecore/api/PathAnalyzer/{Controller} calls while navigating through different paths.
  3. In order to get more clues on how everything is coupled together or answer more specific questions, I believe that you would need to decompile the above mentioned dll.
  4. Last but not the least. Make sure that you introduce some strong caching on this, because those queries might get too heavy.
  • Thanks, I'm afraid that until the XConnect is fully available, this will indeed be the way to go forward. – Kris Verheire Jan 17 '17 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.