User Actions

User Actions (which refers to both user actions and company actions) are events initiated by your users as they navigate your website, blog, docs, and other pages and have an action name like like Clicked Sign Up or Purchased a Subscription.

If you implemented Mixpanel or Amplitude before, you may already be familiar with event-based tracking. By leveraging both event-based tracking with API monitoring, you’re able to understand the entire customer journey from initial sign up to their first API call.

Tracking user actions can only be done with moesif-browser-js. To track user actions server-side, use the HTTP API.

An example tracking actions using moesif-browser-js:

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'
});

Event metadata

Besides the action name, you can also store event metadata such as the color of the button click or the value of plan a customer just purchased.

{
  "button_label": "Get Started",
  "sign_up_method": "Google SSO",
  "some_object": {
      "some_sub_field": "some_value"
    }
}

You can filter and segment using event metadata fields.

Segment on Custom Fields

1. Maintain consistent datatypes

Once a JSON key is seen by Moesif with a specific JSON datatype, you cannot send a different JSON datatype using the same key. For example, if you previously sent to Moesif the following event metadata for an API call:

{
  "some_string": "I am a string",
  "some_int": 77,
  "some_object": {
      "some_sub_field": "some_value"
    }
}

Then, Moesif automatically saves some_string as a JSON string in the metadata schema. You cannot later send a JSON Number using the same some_string key. This is true regardless of the number of levels relative to the object root. The below metadata would now be invalid:

{
  "some_int": 77,
  "some_object": {
      "some_string": 23,
      "some_sub_field": "some_value"
    }
}

The metadata schema is shared across your organization and applications.

2. Avoid dots characters

Be aware that Dot characters in a JSON key for event metadata will be converted into an underscore by Moesif automatically. Hoever, Dot characters in a JSON value are fine and will not be transformed.

For example,

{
  "so.me_str.ing": "I am a string",
  "some.int": 77.23
}

Will be converted by Moesif to:

{
  "so_me_str_ing": "I am a string",
  "some_int": 77.23
}

Updated: