> ## Documentation Index
> Fetch the complete documentation index at: https://moengage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Tracking Events

> Track user events and their properties using the MoEngage React Native SDK for campaigns.

<Info>
  SDK adheres to the MoEngage FUP policies. For more information, refer to the [Fair Usage Policy](https://www.moengage.com/docs/user-guide/data/key-concepts/fair-usage-policy-fup).
</Info>

Tracking events is how you record any actions your users perform, along with any properties that describe the action. Every trackEvent call records a single user action. We recommend that you make your event names human-readable so that everyone on your team can know what they mean instantly.

Every ***trackEvent()*** API expects 2 parameters, event name, and event attributes i.e. instance of ***MoEProperties.*** 

Add all the additional information which you think would be useful for segmentation while creating campaigns.

For example, the following code tracks a Purchase event of a product. We are including attributes like price, quantity, purchase date, and store location which describe the event we are tracking.

<CodeGroup>
  ```javascript JavaScript theme={null}
  import ReactMoE, {
    MoEGeoLocation,
    MoEProperties,
  } from "react-native-moengage";
  let properties = new MoEProperties();
  properties.addAttribute("quantity", 1);
  properties.addAttribute("product", "iPhone");
  properties.addAttribute("currency", "dollar");
  properties.addAttribute("price", 699);
  properties.addAttribute("new_item", true);
  properties.addAttribute("models", ["iPhone15", "iPhone14"]);
  properties.addDateAttribute("purchase_date", "2020-06-10T12:42:10Z");
  properties.addLocationAttribute(
    "store_location",
    new MoEGeoLocation(90.00001, 180.00001)
  );
  ReactMoE.trackEvent("Purchase", properties);
  ```
</CodeGroup>

<Warning>
  * Event names should not contain any special characters other than "\_". It can contain just spaces and an underscore. Also, it should not contain “between”, “greater”, “less”, “in\_the\_last”, “in\_the\_next”, “equal”, “contains”, “starts”, or “is\_not".
  * You can not use "moe\_" as a prefix while naming events, event attributes, or user attributes. It is a system prefix and using it might result in periodic blacklisting without prior communication.
  * You can not use "user\_id" to name custom attributes. It is a reserved system field, and using it might result in an error.
</Warning>

# Analytics

MoEngage SDK tracks user sessions and application traffic sources.To learn more about how user session and application traffic source tracking works, refer to the following docs:

*  [Session and Source Analysis](https://www.moengage.com/docs/user-guide/analyze/analytics/session-and-source/session-and-source-analysis) 
*  [Advanced Session and Source Analysis](https://www.moengage.com/docs/user-guide/analyze/analytics/session-and-source/advanced-session-and-source-analysis)

With user session tracking we have introduced the flexibility to selectively mark events as non-interactive.

## What is a non-interactive event?

Events that do not affect the session calculation in anyways are called non-interactive events. Non-interactive events have the below properties

* Do not start a new session.
* Do not extend the session.
* Do not have information related to a user session.

## How to mark an event as non-interactive?

To mark an event as a non-interactive call ***setNonInteractive()*** of the ***MoEProperties***instance as shown below:

<CodeGroup>
  ```javascript JavaScript theme={null}
  import ReactMoE, {
    MoEGeoLocation,
    MoEProperties,
  } from "react-native-moengage";
  let properties = new MoEProperties();
  properties.addAttribute("quantity", 1);
  properties.addAttribute("product", "iPhone");
  properties.addAttribute("currency", "dollar");
  properties.addAttribute("price", 699);
  properties.addAttribute("new_item", true);
  properties.addAttribute("models", ["iPhone15", "iPhone14"]);
  properties.addDateAttribute("purchase_date", "2020-06-10T12:42:10Z");
  properties.addLocationAttribute(
    "store_location",
    new MoEGeoLocation(90.00001, 180.00001)
  );
  //Marking it as Non Interactive
  properties.setNonInteractiveEvent();
  ReactMoE.trackEvent("Purchase", properties);
  ```
</CodeGroup>
