Integration Options

To best leverage Moesif and API analytics, there are two steps needed to understand the full customer journey:

1. Monitor API calls Monitor API calls

To monitor API calls with Moesif, you can use any of the the Server Middleware SDKs such as for Node.js, Python, and AWS Lambda. If you already have a centralized gateway handling your API traffic such as Kong, NGINX, or 3Scale, you can 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 and APIs. Each SDK has options to select what you want to log.

2. 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: