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

# Tracking Events

<Info>
  SDK adheres to the MoEngage FUP policies. For more information, refer to the [Fair Usage Policy](https://help.moengage.com/hc/en-us/articles/24151864954644-Fair-Usage-Policy-FUP#h_01HQSMZVQWT2KYP0PY1P8GQMRM).
</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()** method call expects 3 parameters. They are the event name, event attributes and an account identifier. Event attributes use **MoEProperties** as an instance that represents attributes of the event. Add all the additional information which you think would be useful for segmentation while creating campaigns.\
For example, the following code tracks an **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 TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import { MoECapacitorCore, MoEProperties } from 'capacitor-moengage-core'

  const properties: MoEProperties = {
        generalAttributes: [
          { name: "quantity", value: 1 },
          { name: "product", value: "iPhone" },
          { name: "currency", value: "dollar" }
          { name: "price", value: 699 }
          { name: "new_item", value: "iPhone" }
        ],
        dateTimeAttributes: [
          { name: "purchase_date", value: "2020-06-10T12:42:10Z" }
        ],
        locationAttributes: [
          { name: "store_location", value: { latitude: 90.00001, longitude: 180.00001} }
        ]
  };

  MoECapacitorCore.trackEvent({ eventName: "Purchase", eventAttributes: properties, appId: "YOUR_WORKSPACE_ID"});
  ```
</CodeGroup>

<Warning>
  * Event names should not contain any special characters other than "\_". It can contain just spaces and 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.
</Warning>

# Analytics

MoEngage SDK has started tracking user sessions and application traffic source. Refer to the [Sessions in MoEngage Analytics](https://help.moengage.com/hc/en-us/articles/35724347745812-Session-and-Source-Overview) and [Source Analysis in MoEngage Analytics](https://help.moengage.com/hc/en-us/articles/35724347745812-Session-and-Source-Overview) to learn more about how user session and application traffic source tracking works.

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 following 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 set **isNonInteractive** property of the **MoEProperties** to **true** as shown below:

<CodeGroup>
  ```javascript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import { MoECapacitorCore, MoEProperties } from 'capacitor-moengage-core'

  const properties: MoEProperties = {
        generalAttributes: [
          { name: "quantity", value: 1 },
          { name: "product", value: "iPhone" },
          { name: "currency", value: "dollar" }
          { name: "price", value: 699 }
          { name: "new_item", value: "iPhone" }
        ],
        dateTimeAttributes: [
          { name: "purchase_date", value: "2020-06-10T12:42:10Z" }
        ],
        locationAttributes: [
          { name: "store_location", value: { latitude: 90.00001, longitude: 180.00001} }
        ],
        isNonInteractive: true
  };

  MoECapacitorCore.trackEvent({ eventName: "Purchase", eventAttributes: properties, appId: "YOUR_WORKSPACE_ID" });
  ```
</CodeGroup>
