User Actions
User (and Company) Actions are events initiated by your users within your UI such as Clicked Sign Up or Purchased a Subscription. By tracking user actions, you’re able to stitch together the entire customer journey even before a customer made any API calls so you can measure funnel metrics like Time to First Hello World and Time to Value.
Tracking user actions are normally done with a client integration such as moesif-browser-js or Moesif’s Segment plugin. If you implemented Mixpanel or Amplitude before, you may already be familiar with event-based tracking.
Moesif also has a HTTP API if you require tracking user actions in your server code also.
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.
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
}