# Screen tracking

Screen views are events that record the pages that your audience visits in your app. They have a `type` property set to `screen`, and a `name` representing the title of the screen or page that a person visited in your app.

Screen view events let you trigger [campaignsCampaigns are automated workflows you set up to send people messages and perform other actions when they meet your criteria.](/journeys/campaigns-in-customerio/) or add people to [segmentsA group of people who match a series of conditions. People enter and exit the segment automatically when they match or stop matching conditions.](/journeys/data-driven-segments/) based on the parts of your app your audience uses. Screen view events also update your audience’s “Last Visited” attribute, which can help you track how recently people used your app.

## Enable automatic screen tracking[](#auto-screenview)

When you enable automatic screen tracking, the SDK sends an event every time a person visits a screen in your app. You can turn on automatic screen tracking by appending `autoTrackActivityScreens(true)` to `CustomerIOBuilder`.

When automatically tracking screen events, we capture the name of the screen with the following priority from highest to lowest:

1.  We check if the current `Activity` has a `label` in the manifest file. If it does, the SDK will use the value for `label`.
2.  We get the class name of the `Activity` and use that value.

The SDK will take whatever value it receives and will strip the word `Activity` from it. Example: If you have an `Activity` with the manifest `label` *or* class name `ProfileActivity`, the SDK will track the screen view with the name `Profile`.

```kotlin
val builder = CustomerIOConfigBuilder(
    applicationContext = this,
    cdpApiKey = "your-cdp-api-key",
).autoTrackActivityScreens(true)

CustomerIO.initialize(builder.build())
```

If you want to send more data with screen events, or you don’t want to send events for every individual screen that people view in your app, you can [send screen events manually](#manual-screenview).

## Manually track screen events[](#manual-screenview)

Screen events use the `.screen` method. Like other events, you can add a map of `properties` object containing additional information about the `screen` event or the currently-identified person.

```kotlin
CustomerIO.instance().screen(
  name = "baseballDailyScores",
  properties = mapOf("prevScreen" to "homescreen", "secondsInApp" to 120)
)
```

## ScreenView Settings[](#screenview-settings)

Customer.io uses `screen` events to determine where users are in your app so you can target them with in-app messages on specific screens. By default, the SDK sends `screen` events to Customer.io’s backend servers. But, if you don’t use `screen` events to track user activity, segment your audience, or to trigger campaigns, these events might constitute unnecessary traffic and event history.

If you don’t use `screen` events for anything other than in-app notifications, you can set the `ScreenViewUse` parameter to `ScreenView.InApp`. This setting stops the SDK from sending `screen` events back to Customer.io but still allows the SDK to use `screen` events for in-app messages, so you can target in-app messages to the right screen(s) without sending event traffic into Customer.io!

```kotlin
val builder = CustomerIOConfigBuilder(
    applicationContext = this,
    cdpApiKey = "your_cdp_api_key"
).region(Region.US)
    .screenViewUse(ScreenView.InApp)
    .addCustomerIOModule(
        ModuleMessagingInApp(
            config = MessagingInAppModuleConfig.Builder(
                siteId = "your_site_id",
                region = Region.US
            ).setEventListener(InAppMessageEventListener()).build()
        )
    )
    .addCustomerIOModule(ModuleMessagingPushFCM())

CustomerIO.initialize(builder.build())
```