Reference: Analytics Filters
This document provides reference documentation for Moesif’s API analytics filters. These filters are available for the following metric types in Moesif API Analytics suite:
Filter Types
The available filters broadly falls into the following six categories:
You may have more filters available to you outside this document’s scope. For example, for GraphQL APIs, Moesif parses GraphQL queries and automatically generates a secondary set of filters called GraphQL Query Filters in the UI. For more information, see API Protocol Support.
Search Function
To enter a custom query expression, select the search
as the filter function. This function allows you to search on single terms within your text fields such as a title
or description
field.
The search
function supports the following operators: -+
to perform a logical AND
operation among the search terms.
|
to perform a logicalOR
operation among the search terms.-
performs a logicalNOT
operation and negates a single search term.
The search
function also supports the following special characters: -"
wraps a set of search terms.
*
wildcard operator to use at the start or end of any search term.(
and)
to specify operator precedence.
For example, if you want to only match against URI Route that does not start with /v4/
, then enter -"/v4/"*
as the search term.
Request Filters
Request
filters allow you to filter on HTTP request data including headers.
Request.Geo IP
Allows you to filter by geographic location data with the following filters:
City
Country Code
Country
Region Code
Region
Timezone
Request.User Agent
Contains filters to query user agent data:
Build
Device
Major
Minor
Name
OS Major
OS Minor
OS
Patch
Request.Body
Contains filters to query data from a HTTP request body. It also contains the wildcard
filter to select a body field using wildcards such as locations.*.name
. You may find this helpful when you have arbitrary keys in the request body.
Request.URI Segments
Allows you to filter on URI segments. Moesif assigns zero-based numbers to the URI segments. Therefore, the first URI segment has the number 0
, and so on.
Request.Headers
Allows you to filter on HTTP request headers. It also contains the wildcard filter to query the HTTP request headers using wildcards.
Request.API Version
If you set an API version using Moesif SDKs, you can filter on the version.
Request.Content Length
Corresponds to the Content-Length
HTTP request header.
Request.Content Type
Corresponds to the Content-Type
HTTP request header.
Request.IP Address
The IP address of the user agent making a request. Moesif only supports IPv4 addresses.
Request.Time
The request time.
Request.URI Raw
The raw URI that was requested.
Request.URI Route
The path components of the URI—for example, https://myblog.com/posts
contains the /posts
route.
Request.Verb/Method
Allows you to filter on the HTTP request methods.
Response Filters
Response
filters allow you to filter on HTTP response data including headers.
Response.Body
Contains filters to query data from a HTTP response body. It also contains the wildcard
filter to select a body field using wildcards such as locations.*.name
. You may find this helpful when you have arbitrary keys in the response body.
Response.Headers
Allows you to filter on HTTP response headers. It also contains the wildcard
filter to query the HTTP response headers using wildcards.
Response.Status
Allows you to filter on the HTTP response status codes.
Response.Content Length
Corresponds to the Content-Length
HTTP response header.
Company Filters
Contains filters to query on company analytics and data.
For more information about Moesif User and Company analytics features, see Introduction to User and Company Behavior.
Company.Enrichment
Allows you to filter on demographic enrichment data that you have attached on company profiles.
Moesif Enterprise supports demographic enrichment for companies that allows you to add demographic data to customers. For more information, contact us.
Company.Subscriptions
Allows you to filter on subscription data for a company.
If you monetize your API, you can use these filters to set up complex business logic for different billing providers such as Chargebee, Recurly, Stripe, and more.
Company.Cohort
Allows you to filter on saved cohorts for companies.
Company.Company Domain
Lets you filter by company website domains after setting them in the company metadata.
Company.Created
The time you created a company profile in Moesif.
Company.First Seen Time
The first time a company accesses your product.
Company.Last Seen Time
The last time a company used your product.
Company.TTFHW
The Time to First Hello World (TTFHW) metric for a company.
User Filters
Contains filters to query on user analytics and data.
For more information about Moesif User and Company analytics features, see Introduction to User and Company Behavior.
User.Enrichment
Allows you to filter on demographic enrichment data that you have attached on user profiles.
Moesif Enterprise supports demographic enrichment for companies that allows you to add demographic data to customers. For more information, contact us.
User.Subscriptions
Allows you to filter on subscription data for a company.
If you monetize your API, you can use these filters to set up complex business logic for different billing providers such as Chargebee, Recurly, Stripe, and more.
User.Cohort
Allows you to filter on saved cohorts for companies.
User.Created
The time you created a user profile in Moesif.
User.First Seen Time
The first time a user accesses your product.
User.Last Seen Time
The last time a company used your product.
User.Modified Time
The last time a user profile was modified.
User.TTFHW
The Time to First Hello World (TTFHW) metric for a user.
User.Email
Lets you filter by associated user’s email after setting it in the user metadata.
User.Name
Lets you filter by associated user’s name after setting it in the user metadata.
User.User Phone Number
Lets you filter by associated user’s phone number after setting it in the user metadata.
User.Metadata
User demographics or other properties you store in the user metadata.
Metadata Filters
The Metadata
filter allows you to filter on custom metadata you set using event metadata.
Common Filters
The following common filters are available outside the preceding five filter types:
Action Name
Lets you filter by custom actions.
Auth/Session Token
The authentication or session token used when making API calls—for example, credentials in the Authorization
HTTP request header. For more information, see Identification of Users.
Blocked By
Lets you filter by governance rules.
Company ID
Allows you to filter API calls for a specific customer by a company ID. This feature requires you to set up company identification using an SDK. Otherwise, you may not get accurate results.
Elapsed Duration
Lets you filter by the API request duration in milliseconds. The elapsed duration means the time elapsed between the API request and the server response.
Event ID
Moesif assigns a unique ID to each API call called an event ID. If you know the event ID—for example, you can use it here as a filter.
Event Type
Allows you to filter by the event type: API Calls or Actions.
Identified User ID
Allows you to filter API calls for a specific end user by a user ID. This feature requires you to set up user identification using an SDK. Otherwise, you may not get accurate results.
Request Direction
This filter applies to API Calls only and allows you to filter by the direction of API requests.
A value of Incoming
shows only API calls to your own services you provide. A value of Outgoing
only shows API calls going out to a third-party service.
Tag
Allows you filter by event tags.
User ID
A random GUID Moesif assigns to anonymous website visitors who don’t possess identified user IDs. This filter is only relevant when using Moesif JavaScript Browser SDK in a client integration.
Filter Operators
When you add a filter, you’ll see different operator options depending on the data
type. If data type of a field is ambiguous—for exaxmple, field.path.foo
might be a string or date, filter operators for both string and date data types become available. However, the operator only acts on the data type that matches the operator.
exist
, not exist
Available for all data types.
Moesif considers either null
or undefined
as not exist
.
is
, is not
Available for the following data types:
- Numbers
- Strings
- Booleans
You can select multiple values for these operators.
search
, begins with
, ends with
, includes
, not includes
Available for only string data type.
>
, <
, >=
, >=
, ==
Available for numbers and dates.
is before
, is after
, between
Available for numbers and dates.
For a number type field, Moesif treats the field value as epoch in milliseconds.
count >
, count <
, count >=
, count <=
, count =
Available for array data type in request or response body.
It counts the number of elements inside the array. For example, if the original
value of the field field.path.foo
is []
, the exist
operator evaluates
to truthy, but the count
evaluates to 0
.
key count >
, key count <
, key count >=
, key count <=
, key count =
Available for object data type in request or response body.
It counts number of keys inside the object. For example:
- Original value of
field.path.foo
is{}
. Theexist
operator evaluates to truthy, but its key count evaluates to0
. - Original value of
field.path.foo
is{ boo: 15}
. The key count evaluates to1
. - Original value of
field.path.foo
is{ boo: null, far: null }
. The key count evaluates to2
.