> ## 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 actions and event attributes using the MoEngage Cordova SDK for segmentation and 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.

<CodeGroup>
  ```javascript JavaScript theme={null}
  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={null}
  {
    "<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={null}
  {
    "<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={null}
  {
    "<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={null}
     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. 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.
