OpenFin web analytics options

OpenFin supports everything that Chrome supports, so when it comes to web analytics, you have a wide range of options. This article covers some of the options that OpenFin Applications Providers can implement.

Application Code

As an application is yours, you have the option of writing your own logging/auditing library. This library can be called during application load, then your developers would call it to capture specific events occurring in your application. Additionally, OpenFin’s System APIs can be leveraged to capture relevant application information as well as information beyond what the browser alone captures.

OpenFin’s System API empowers Applications Providers to capture information related to the end user’s machine, the OpenFin version, and an end user’s monitor information.

OpenFin has a Diagnostic API Guide Repo that demonstrates many of the features that the System API provides.

Examples

Host Specs

Retrieving the machine specs to identify if the hardware is a potential cause to an issue:

fin.System.getHostSpecs().then(specs => console.log(specs)).catch(err => console.log(err));

Refer to the HostSpecs interface for the structure of this data. It is an Application Provider’s decision to log all or part of the information retrieved.

CPU & Memory

If you’re interested in the current CPU and Memory utilization of your application, do something similar to the following:

const formatBytes = (size, places) => {
    let KB = 1024;
    let MB = KB * 1024;
    let GB = MB * 1024;

    if (size > GB) {
        return (size / GB).toFixed(places) + 'GB';
    } else if (size > MB) {
        return (size / MB).toFixed(places) + 'MB';
    } else if (size > KB) {
        return (size / KB).toFixed(places) + 'KB';
    } else if (size === 0) {
        return '0';
    } else {
        return size.toFixed(1) + 'B';
    }
};

const getCurrentEntity = (apps) => { 
    for (app of apps) { 
        return app.entities.find(e => e.name === fin.me.identity.name)
    }
}

const getAppStats = async ()=> {
    const {apps} = await fin.System.getAllProcessInfo();
    const currentEntity = getCurrentEntity(apps)
    if(currentEntity !== undefined && currentEntity !== null) {
        let cpu = currentEntity.cpuUsage;
        let memory = formatBytes(currentEntity.workingSetSize||0.0, 1);
        return { cpu, memory };
    }
    return null;
};


// call this to get an object containing the current cpu and memory usage of your application.
await getAppStats();

When Would You Use These Types of APIs?

On Application Load

Application Providers should capture information on application load as it is unlikely to change while the application is running (for example, the specs of the machine or the number of monitors a user has).

At Intervals

Information to capture at intervals (make sure that the interval is configurable so you can increase it for users who are having an issue) are data points such as:

  • Total memory

  • CPU usage

Determining interval retrieval is dependent on the Application Provider’s appetite for collecting this information. OpenFin recommends that these intervals are customized in segments that are not taxing on your application.

APIOn Application LoadIn Intervals
System.getHostSpecsYESNO
System.getCommandLineArgumentsYESNO
System.getUniqueUserIdYESNO
System.getMonitorInfoYESNO
System.getVersionYESNO
System.getRvmInfoYESNO
System.getAllProcessInfo
(see example above)
YESYES
Application.getZoomLevelYESYES

Additional information you can capture:

DataOn Application LoadIn Intervals
Your own app version numberYESNO
A unique instance ID generated
at startup (to distinguish between multiple instances of your app)
YESYES
Per page memory
Resource
NOYES
Long Running Functions
Resource
NOYES

By capturing additional information, Application Providers can assist support staff and end users if there is an issue by analyzing changes in performance across releases.

📘

NOTE

When considering third-party components, Application Providers should evaluate if they can hook into specific events if they desire to capture information related to interactions with that component. This data can be sent back to your own service and then aggregated with other data sources. This approach could be combined with one of the following options to give you two sources of data.

Commercial Solutions

Google Analytics allows Application Providers to track user sessions and behavior. The solution has been around for a long time and is available as both a free (with limitations) version and an Enterprise version. Which version you use, depends on the needs of your organization.

Adobe Web Analytics offers an alternative to Google Analytics. Which solution your company uses depends on your needs.

There is a lot of training material out there for Adobe Analytics but it seems to require more investment with regards to effort than google analytics to get started.

Adobe Analytics has a lot of features including its support for browsers.

Heap automatically captures every web, mobile, and cloud interaction: clicks, submits, transactions, emails, and more.

Open Source Solutions

Matomo is an open source alternative to Google Analytics. It offers a commercial cloud-hosted version. You can also self-host. The self-hosted version is open source but offers commercial plugins through a public marketplace.

Open Web Analytics (OWA) is an open source web analytics software framework that you can use to track and analyze how people use your websites and applications. OWA is licensed under GPLv2 and provides developers with easy ways to add web analytics to their sites using simple Javascript and PHP based APIs.

OpenWeb Analytics Demo