4

We're using Angular to handle site's front-end, and I'd like to add some events which happen there, like opening "new" pages based on JavaScript to Path Analyzer.

This is how I tried to do it:

var pageEventData = new PageEventData("Page Visited", new System.Guid("7DAF6F40-87EA-4594-B977-4994E5B439D3"))
{
    ItemId = new System.Guid("92B09B21-3B5B-43E3-939D-A1C62779AED9"),
    Data = title,
    Text = "page "+ title + " was visited"
};

Tracker.Current.Session.Interaction.PreviousPage.Register(pageEventData);

(where "7DAF6..." is id of /sitecore/system/Settings/Analytics/Page Events/Page visited event and "92B.. " just a random id of one of the page items I use for testing)

And this seems wrong, even though the event actually gets registered to Mongo's db.Interactions table as a PageEvent of 'Page visited' type, I don't see it in Path Analyzer. Is there actually a way to simulate a new page being visited and get a new node to be added to Sitecore's Path Analyzer?

Here is an example of what gets registered in the db.interactions table: https://gist.github.com/epetrashen/92d2fe0e8b882932e2cf88cebe8868f3

  • 1
    If it's being registered in MongoDB then though code is working. It sounds like there is something missing in the other end after the data has been aggregated. Have you tried Deploy Marketing Definitions on the Control Panel? – Ian Graham Nov 2 '16 at 12:48
  • @IanGraham yes, I actually haven't been able to make Path Analyzer work before I attempted Deploy Marketing Definitions, so now it's been done. – Elena P Nov 2 '16 at 14:46
  • Have you deployed the maps under sitecore/admin/PathAnalyser.aspx yet? – Ian Graham Nov 2 '16 at 15:17
  • @IanGraham yes, deployed all of the maps and also tried rebuilding them & pretty much all of the other options available under sitecore/admin/pathanalyzer.aspx. So do you think if an event is registered in db.interactions as sitecore's "Page Visited" PageEvent it's enough for it to become a new node in Path Analyzer? The "real sitecore pages" I visit while testing this are actually being shown in PA, it's only a problem for these javascript-based pages I try to register myself, so I thought I must be lacking something. – Elena P Nov 3 '16 at 7:05
  • Oh ok, can you give a bit of info around how you are calling the server side logic. How is the controller set up? – Ian Graham Nov 3 '16 at 7:13
2

I have managed to solve this I think. In Mongo's dbo.interactions pages are stored in a nested array, and page events are stored as a nested array within each page. Apparently, my mistake was that I've been expecting PageEvents of "Page visited" type to be represented in Path Analyzer as nodes, but what actually gets displayed there are Pages themselves.
So now each time a front-end event I'm interested in happens, I'm using a fake page that is "visited" and edit its Tracker.Current.CurrentPage.Url.Path and Tracker.Current.CurrentPage.Item.Id so that it looks like another item (my JavaScript-based page) was being visited. Which is clumsy but hey, it works! :)

| improve this answer | |
  • That's a clever solution! I'm glad you got it working. – Dmytro Shevchenko Nov 9 '16 at 21:27
  • Awesome work around! You can also use Experience Maps instead of Page Maps, which are only built from pages. Experience Maps allow you to have page events, goals, outcomes, etc. in xDB. You can create your own too :) – Alex Shyba Jul 20 '18 at 17:27

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.