Platform Overview

The Moesif API Analytics platform enables you to track both API usage and customer behavior on your website. It then associates behavior to users (or companies) to create a holistic view of what a customer did with your platform.

How Moesif works

Moesif automatically analyzes REST, GraphQL, RPC, and other APIs with a variety of content including JSON and XML. There are two integration points, your API and your frontend (web). While you don’t need to do both, it is recommended for the best visibility into customer behavior. Moesif supports traditional APIs running on-premises or on cloud provider VM’s such AWS EC2 or Azure. Moesif also supports Serverless and BaaS platforms such as AWS Lambda, Heroku, and Azure Web Apps.

1. Monitor API calls Monitor API calls

Monitor API Calls

The Moesif server agent can be installed with a variety of Server SDKs for common frameworks like Node.js, Django, and AWS Lambda. If you already deployed an API gateway solution such as Kong, NGINX, or 3Scale, you can choose to use one of the API Gateway Plugins in lieu of a SDK.

Data that is logged

The SDKs will capture typical data around API calls including the latency, URI route, response status, among other information. SDKs have the option to chose whether to log the body payloads, or mask certain header or body fields if you have privacy requirements or in a highly regulated industry.

Incoming vs outgoing

The Moesif SDKs can log both incoming API calls hitting your services and also outgoing API calls to other services such as for customer webhooks. Each SDK has options to select what you want to log.

2. Track Users Track Users

Track Users

The second step is to set up tracking user and/or company behavior. This enables API calls to be tied back to individual customers and also enrich your API analytics with actions a user may have done such as sign up or purchased a plan.

You can decide to track only individual users, only track companies, or track both depending on your business model. A company is a group of related users under the same account, common for B2B companies.

Save user/company metadata

Users in Moesif are identified by a user_id and can also be linked to a company via the company_id field. Users can contain metadata such as email, person demographics, and user-level marketing attribution. 

You can store user profiles via one of the API Lib’s updateUser() functions or call the identifyUser() unction in moesif-browser-js.

A sample user is below:

  {
    "user_id": "12345",
    "company_id": "67890",
    "session_token": "XXXXXXXXXX",
    "campaign": {
      "utm_source": "google",
      "utm_medium": "cpc",
      "utm_campaign": "adwords",
      "utm_term": "api+tooling",
      "utm_content": "landing"
    },
    "metadata": {
      "email": "john@acmeinc.com",
      "first_name": "John",
      "last_name": "Doe",
      "title": "Software Engineer",
      "sales_info": {
          "stage": "Customer",
          "lifetime_value": 24000,
          "account_owner": "mary@contoso.com"
      }
    }
  }

Companies in Moesif are identified by a company_id and is similar to a user, but stores account level properties such as company name, website domain, company demographics, and company-level marketing attribution. You can store company profiles via one of the API Lib’s updateCompany() functions or call identifyCompany() function in moesif-browser-js.

A sample company is below:

{
  "company_id": "12345",
  "company_domain": "acmeinc.com",
  "campaign": {
    "utm_source": "google",
    "utm_medium": "cpc",
    "utm_campaign": "adwords",
    "utm_term": "api+tooling",
    "utm_content": "landing"
  },
  "metadata": {
    "org_name": "Acme, Inc",
    "plan_name": "Free",
    "deal_stage": "Lead",
    "mrr": 24000,
    "demographics": {
      "alexa_ranking": 500000,
      "employee_count": 47
    }
  }
}

Track user/company actions

User (and company) actions are initiated events by your users like Clicked Sign Up or Purchased a Subscription. By tracking user actions, you’re able to get a more complete picture of how customers navigate through your website and onboarding flows even before they made their first API calls. Currently only moesif-browser-js supports tracking user actions via the track() function.

A sample user action is below:

var moesif = require('moesif-browser-js');

moesif.init({
  applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
});

// The first argument (required) contains the action name string.
// The second argument (optional) contains event metadata.
moesif.track('Clicked Sign Up', {
  button_label: 'Get Started',
  sign_up_method: 'Google SSO'
});

Other integrations

Moesif also has a codeless option via the Moesif cloud proxy which can be used in environments where installing an SDK doesn’t make since such as for monitoring third party web hooks. The cloud proxy works by generating a trackable URL that is a drop in replacement for your original URL.

Updated: