0
votes

I wanted to see how many times users visited that certain screen/page of my application using MFP Analytics. I'm wondering if I can use the analytics logs and make a log per screen and create a custom chart for the logs?

I based my assumptions on this mobilefirst tutorial: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.0/moving-production/operational-analytics/

2

2 Answers

2
votes

Yes, you can do this. It is as simple as creating a custom event such as "page X was visited" and on every load of a page, log the action (of loading it) and then send it back to the Analytics server. You can then splice your analytics data per page (event).

You can see this explained and demoed in the following:

4
votes

Yes, you can use the following to log the page.

WL.Analytics.log({page: 'pageA'}, 'Custom event for visiting page A');
WL.Analytics.send()

Then you can send it to the analytics console with WL.Analytics.send().

You can use a setTimeout function if you want to send it immediately after logging, so that you can ensure that there is time for the log to write to the disk before it is sent.

setTimeout(function () {
    WL.Analytics.send();
}, 300);

Then you can create a custom chart in the analytics console with custom activities, property "page."