> For the complete documentation index, see [llms.txt](https://developers-apps-in-toss.toss.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-en/common/growth/analytics/user-behavior.md).

# User behavior logging

`Analytics`An object for recording and analyzing user behavior. It collects events such as screen entry, button clicks, and component exposure, and can be used to improve the service and analyze user flows.

{% hint style="info" %}
**Please check the prerequisites**

* SDK version **`v1.0.3`** must be at least.
* Events are not collected in sandbox or QR test environments. They are collected only in the live environment.
* Service launch **The next day (+1 day)** from the console **Analytics > Events** You can check the data on the screen.
  {% endhint %}

[Log (event) guide](https://developers-apps-in-toss.toss.im/guide/analytics/logging).

***

**Signature**

```typescript
Analytics: {
    readonly init: typeof init;
    readonly Screen: typeof LoggingScreen;
    readonly Press: import("react").ForwardRefExoticComponent<import(".").LoggingPressProps & import("react").RefAttributes<unknown>>;
    readonly Impression: typeof LoggingImpression;
    readonly Area: typeof LoggingArea;
}
```

**Properties**

* inittypeof init

  This is a function that applies settings when starting the analytics feature. It must be called once when the app initializes.
* Presstypeof LoggingPress

  A component that logs click events when a user clicks a button or touchable component.
* Impressiontypeof LoggingImpression

  A component that determines whether a user has actually viewed a specific component on the screen and logs it.
* Areatypeof LoggingArea

  A component that groups multiple components into one area for analysis.

***

### Initialize analytics

**`Analytics.init`**

`Analytics.init`is a function that applies settings when starting analytics. `Analytics.Press`, `Analytics.Impression`, `Analytics.Area`must be called before using it.

**Signature**

```typescript
declare function init(options: AnalyticsConfig): void;
```

**Parameters**

* **options** · Required · `AnalyticsConfig`

  A configuration object for using analytics.

***

### Record click events

**`Analytics.Press`**

`Analytics.Press`is a component that records click events when a user presses an element. Use it by wrapping points where user interactions occur, such as button clicks or purchase actions.

{% hint style="info" %}
**Click events are collected only in the live environment**

In sandbox or QR test environments, click events are not actually accumulated. The time when you can check the data in the console is **the day after launch (+1 day)** .
{% endhint %}

**Signature**

```typescript
LoggingPress: import('react').ForwardRefExoticComponent<LoggingPressProps & import('react').RefAttributes<unknown>>;
```

**Example**

```tsx
import { Analytics } from '@apps-in-toss/framework';
import { Button } from 'react-native';

// Automatically collects click events for clickable elements.
function TrackElements() {
  return (
    <Analytics.Press>
      <Button label="Press Me" />
    </Analytics.Press>
  );
}
```

***

### Record impression events

**`Analytics.Impression`**

`Analytics.Impression`is a component that detects whether an element is displayed in the viewport and records impression events. Use it to track whether products, banners, cards, etc. located below the scroll are exposed.

**Signature**

```typescript
function LoggingImpression({
  enabled,
  impression: impressionType,
  ...props
}: LoggingImpressionProps): import('react/jsx-runtime').JSX.Element;
```

**Example**

```tsx
import { Analytics } from '@apps-in-toss/framework';

// Automatically collects exposure information within the area.
function TrackElements() {
  return (
    <Analytics.Impression>
      <Text>Hello</Text>
    </Analytics.Impression>
  );
}
```

***

### Record by grouping into areas

**`Analytics.Area`**

`Analytics.Area`is a component that groups multiple components into one area and records exposure and click events together. You can aggregate them into one log when the specified area is exposed or clicked.

**Signature**

```typescript
function LoggingArea({
  children,
  params: _params,
  ...props
}: LoggingAreaProps): import('react/jsx-runtime').JSX.Element;
```

**Example**

```tsx
import { Analytics } from '@apps-in-toss/framework';
import { View, Text } from 'react-native';

// Automatically collects exposure or click information within the area.
function TrackElements() {
  return (
    <Analytics.Area>
      <View>
        <Text>Hello</Text>
        <Text>World!</Text>
      </View>
    </Analytics.Area>
  );
}
```


---

# 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://developers-apps-in-toss.toss.im/documentation/api-and-sdk-en/common/growth/analytics/user-behavior.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.
