Event tracking is used to track user behavior in an app. And later based on the same tracked behavior you can target those users for sending relevant notifications. Make sure to track all the events relevant to your business, so that your product managers and marketers can segment your app users and create targeted campaigns. For eg. You can track what a user is purchasing, whether has a user added an item to the cart etc.Documentation Index
Fetch the complete documentation index at: https://moengage-crashes-in-debug-feedback.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
SDK adheres to the MoEngage FUP policies. For more information, refer to the Fair Usage Policy.
How to track events?
Every event has 2 parts to it, the “name” of the event and the properties/attributes of the event. You have to make use of MoEngageProperties to track events and their attributes. For eg. The following code tracks aSuccessful Purchase event. We are including attributes like the Product Name, a Brand Name that describes the event we are tracking.
Non-Interactive EventsEvents that should not affect the session duration calculation in anyways in MoEngage Analytics should be marked as a Non-Interactive events. Refer to this for more info on the same.
Validations and restrictions
Event attributes have two layers of validation that apply across bothDEBUG and release builds:
- Naming and format rules — these always apply, regardless of build configuration.
- Type validation — invalid attribute values cause a fatal exception in
DEBUGbuilds and are silently dropped from the payload in release builds. The rest of the event is tracked.
In the iOS SDK,
DEBUG mode means the SDK was initialized using initializeDefaultTestInstance(_:) (TEST workspace) and the app is running attached to Xcode. This is different from a release build that has debug symbols enabled.Naming and format rules
- Attribute names must be non-empty. Passing an empty string (
"") as an attribute name causes a fatal exception inDEBUGbuilds. In release builds, the attribute is dropped. - Reserved prefixes. You cannot use
moe_as a prefix when naming events, event attributes, or user attributes. It is a system prefix, and using it might result in periodic blocklisting without prior communication.
Supported attribute value types
Attribute values must be one of:String, Number, Date, MoEngageGeoLocation, Dictionary (with string keys and supported values), or Array (of supported values). If an unsupported value is passed:
- In
DEBUGbuilds, the SDK throws a fatal exception and crashes the app to surface data issues early in development. - In Release and TestFlight builds, the SDK silently drops the specific invalid attribute and logs the issue. The rest of the event payload is still tracked.
DEBUG exception:
- Passing
null(NSNull()). - Passing custom models or UI elements (for example,
UIColor,UIImage). - Passing invalid numbers like
NaNorInfinity. - Passing empty Arrays or Dictionaries.
- Nesting
DateorMoEngageGeoLocationobjects inside an Array or Dictionary. These must be passed directly as values.