> ## 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.

<CodeGroup>
  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  var moe = MoECordova.init(YOUR_APP_ID);
  moe.trackEvent(eventName, generalAttributes, locationAttributes, dateTimeAttributes, isNonInteractive);
  ```
</CodeGroup>

The trackEvent() takes in 5 parameters eventName and eventAttribute.

* eventName : String
* generalAttributes : JSON Object for general attributes. Accepted data types are string, number, boolean

<CodeGroup>
  ```json JSON theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "<attribute_name>": "<attribute_value>",
    "<attribute_name>": "<attribute_value>",
    "<attribute_name>": "<attribute_value>",
    ...  
  }
  ```
</CodeGroup>

* locationAttributes: JSON Object for location attributes. Accepts attribute name and latitude and longitude

<CodeGroup>
  ```json JSON theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "<attribute_name>": {
      "latitude": <latitude>,
      "longitude": <longitude>
    },
    "<attribute_name>": {
      "latitude": <latitude>,
      "longitude": <longitude>
    },
    "<attribute_name>": {
      "latitude": <latitude>,
      "longitude": <longitude>
    },
    ...
  }
  ```
</CodeGroup>

* dateTimeAttributes: JSON Object for date-time attributes. Accepts only ISO-8601 format dates

<CodeGroup>
  ```json JSON theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "<attribute_name>": "yyyy-MM-dd'T'HH:mm:ss.fff'Z'",
    "<attribute_name>": "yyyy-MM-dd'T'HH:mm:ss.fff'Z'",
    "<attribute_name>": "yyyy-MM-dd'T'HH:mm:ss.fff'Z'",
    ...
  }
  ```
</CodeGroup>

* isNonInteractive: true if you want the event to be non-interactive, else false.

Apart from the **eventName** parameter, other parameters are non-mandatory you can choose to pass **null** or  or **undefined**.\
It is important to maintain the order in which parameters are passed, i.e. if you want to pass only the location attributes general attribute should be passed **null** or  or **undefined**

Example

<CodeGroup>
  ```json JSON theme={"theme":{"light":"github-light","dark":"github-dark"}}
     moe.trackEvent("testEvent", {"attr1": "string", "attr2": 123, "attr3": false},{"loc1": { "latitude": 14.90123,"longitude": 13.1627} },
      {"date1" : "2017-08-02T06:05:30.000Z"}, true);
  ```
</CodeGroup>

<Info>
  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.
</Info>

# Analytics

MoEngage SDK has started tracking user session 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 below properties

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