• English日本語한국어
  • Log inStart now

Report mobile monitoring custom events and attributes

By default, New Relic collects some event data from your mobile app to New Relic, such as interactions, sessions, crashes, and request errors. However, you can also create your own custom attributes and events for more detailed querying and analysis.

Create custom attributes and events

You can create custom session-level attributes for default events using the mobile agent SDK. For example, to record a username attribute for some part of your iOS or Android app, you would use the setAttribute API. These attributes are session-related information and are shared by multiple mobile event types.

You can also create entirely new custom event types and assign them their own custom attributes, using the recordCustomEvent API.

To help with crash analysis, you can use the SDK to create MobileBreadcrumb and MobileHandledException events. These events are available for querying and also displayed in the crash event trail UI.

For more on creating custom attributes and custom events, see:

Mobile event and attribute query examples

Here are some examples of using NRQL to query your mobile app events and attributes:

Size limits and restricted characters

Limits for custom attributes added to default mobile events:

  • Attributes: 128 maximum
  • String attributes: 4 KB maximum length (empty string values are not accepted)

Limits for custom events:

  • Attributes: 254 maximum per event (number includes default session attributes)
  • String attributes: 4 KB maximum length (empty string values are not accepted)

Naming syntax and rules: See Rules for custom data.

Set the time to send data

By default, New Relic transmits event data in any of these situations:

  • A session has been ongoing for 600 seconds.
  • The app session ends by backgrounding.
  • The app crashes.

If the app crashes, New Relic collects the attributes and events for that session. (On iOS, this happens the next time the app is launched). You can then use NRQL to query and analyze the event and attribute data.

To set the maximum time (in seconds) that the agent will store events in memory, see Set max buffer time.

Privacy considerations

If you want to collect personal data via custom attributes, please consult with your privacy or legal teams. Be sure to follow your organization's obligations for notices and consent regulations.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.