> For the complete documentation index, see [llms.txt](https://docs.growlytics.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.growlytics.in/integration/ios-sdk/tracking-events.md).

# Tracking Events

Growlytics starts tracking some events as soon as you  [integrate the SDK](/integration/ios-sdk/install-ios-sdk.md). These are called *System Events* and track some generic user interactions with your app and campaigns. [Here's a list of the *System Events*](/core-concepts-1/events.md) that are automatically tracked by us.

You can create *Custom Events* to track any other user interactions that are crucial for your business. Each *Custom Event* can further be defined by Event Attributes like price, quantity, category, etc. Such granular data enables you to engage users through highly contextual and personalized campaigns through all engagement channels.

## Tracking Custom Events

Here's how you can track custom events in Growlytics iOS SDK.

{% tabs %}
{% tab title="Swift" %}

```swift
import Growlytics

class MyController: UIViewController {

    func myfunction() {
    
        /**
            Your Login Logic
        **/
        
        let eventAttributes: [String:Any]  = [
            "Product ID": 1337,
            "Price": 39.80,
            "Quantity": 1,
            "Product": "Givenchy Pour Homme Cologne",
            "Category": "Fragrance",
            "Currency": "USD",
            "Is Premium": true
        ]
        Analytics.getInstance().track("Product Purchased", eventAttributes)
        
    }
}
```

{% endtab %}
{% endtabs %}

## Guidelines

Here are a few things to keep in mind:

* Growlytics sends all events data periodically in batches to minimize network usage and maximize mobile battery life for your users.
* *Custom Event* and *Custom Event Attribute* names are case sensitive and must be less than 50 characters long. `String` attribute values must be less than 1000 characters long.
* You can create a maximum of 25 *Event Attributes* of each data type for a *Custom Event.*
* The first datapoint synced to Growlytics defines the data type for that event attribute. Thus, data types must be consistent with the value that you want to store against the attribute. If the data type is changed at a later date, then *Custom Event Attribute* data will stop flowing to your Growlytics dashboard.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.growlytics.in/integration/ios-sdk/tracking-events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
