Customer.io
  • Platform
  • Pricing
  • Resources
  • Company
  • Sign In
Request Demo
  • Features
  • Pricing
  • Customers
  • Docs

Request Demo Sign In
  • Documentation
    • Getting Started
    • Accounts & Workspaces
    • People
    • Segmentation
    • Campaigns & Workflows
    • Message Channels
    • Liquid & Personalization
    • Metrics
    • Data & Integrations
  • API
    • API Reference
    • Reporting Webhooks
    • Integration Libraries
  • SDK
    • iOS
    • Android
  • Release Notes
Android
  • Get Started
  • Identify people
  • Track events
  • Push notifications
  • Rich push notifications
  • Test support
  • Migrate from an earlier version
  • Changelog
    • Get Started
    • Identify people
    • Track events
    • Push notifications
    • Rich push notifications
    • Test support
    • Migrate from an earlier version
    • Changelog
    • Get Started
    • Identify people
    • Track events
    • Push notifications
    • Rich push notifications
    • Test support
    • Migrate from an earlier version
    • Changelog
    • In-app messages

30

Track events

Events represent things people do in your app, website, etc, so that you can track your audience’s activity and metrics. Use events to segment your audience, trigger campaigns, and capture usage metrics in your app.

This page is part of an introductory series to help you get started with the essential features of our SDK. The highlighted step(s) below are covered on this page. Before you continue, make sure you've implemented previous features—i.e. you can't identify people before you initialize the SDK!

graph LR getting-started(Install SDK) -->B(Initialize SDK) B --> identify(identify people) identify -.-> track-events(Send events) identify -.-> push(Receive push) identify -.-> rich-push(Receive Rich Push) track-events --> test-support(Handle errors) push --> test-support rich-push --> test-support click getting-started href "/docs/sdk/android/beta/getting-started" click B href "/docs/sdk/android/beta/getting-started/#initialize-the-sdk" click identify href "/docs/sdk/android/beta/identify" click track-events href "/docs/sdk/android/beta/track-events/" click push href "/docs/sdk/android/beta/push" click rich-push href "/docs/sdk/android/beta/rich-push" click test-support href "/docs/sdk/android/beta/test-support" style track-events fill:#B5FFEF,stroke:#007069

Track a custom event

After you identify a person, you can use the track method to send events representing their activities to Customer.io. When you send events, you can include event data—information about the person or the event that they performed.

In Customer.io, you can use events to trigger campaigns and broadcasts. Those campaigns might send someone a push notification or manipulate information associated with the person in your workspace. You can reference the data in your event to segmentA segment is a group of people in your audience that you want to target with campaigns, messages, etc. You can join groups of people manually, or by attribues and event data. members of your audience or as variables in your messages using liquidA syntax that supports variables, letting you personalize messages for your audience. For example, if you want to reference a person’s first name, you might use the variable {{customer.first_name}}..

Events include the following:

  • name: the name of the event. Most event-based searches in Customer.io hinge on the name, so make sure that you provide an event name that will make sense to other members of your team.
  • attributes (Optional): The body of the event. You can reference attributes in messages and other campaign actionsA block in a campaign workflow—like a message, delay, or attribute change. using liquidA syntax that supports variables, letting you personalize messages for your audience. For example, if you want to reference a person’s first name, you might use the variable {{customer.first_name}}. in the format {{event.<attribute>}}.
CustomerIO.instance().track(
  name = "purchase",
  attributes = mapOf("product" to "socks", "price" to "4.99")
)

 Check out our sample app!

Our Remote Habits app, provides a real-world example and can act as a template to help you implement the SDK.

Screen view events

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 campaignsA series of actions that you perform for each person who matches criteria. Campaigns typically send people a series of messages, but you can also use campaigns to send webhooks, update attributes, etc. 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. 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

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 autoTrackScreenViews(true) to CustomerIO.Builder.

When automatically tracking screen events, we use the label in your manifest file as the name of the event. If your screen doesn’t have a label, the event name will be empty.

CustomerIO.Builder(
  siteId = "your-site-id",
  apiKey = "your-api-key",
  appContext = this
)
.autoTrackScreenViews(true)
.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.

Send your own screen events

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

CustomerIO.instance().screen(
  name = "baseballDailyScores",
  attributes = mapOf("prevScreen" to "homescreen", "secondsInApp" to "120")
)
Copied to clipboard!
    • Track a custom event
    • Screen view events
      • Enable automatic screen tracking
      • Send your own screen events
Latest release
Stable
Is this page helpful?

How can we make it better?

We appreciate your feedback!


Product
  • Features
  • Customer Success
  • Professional Services
  • Pricing
  • Workflows
  • Ad Audience Sync
  • Watch a Demo Video
Resources
  • Documentation
  • Release Notes
  • Customer.io API
  • Getting Started Guide
  • Integrations Catalog
  • Data Export Methods
  • Security and Compliance
Industry
  • SaaS
  • EdTech
  • Two-Sided Marketplaces
  • FinTech
  • Internet of Things (IoT)
  • Subscription Box
  • Media Companies
Company
  • Blog
  • Support
  • Partners
  • Customers
  • About
  • Careers
  • Contact Us
  • Privacy Policy
  • Terms of Service
  • Status
  • © Peaberry Software, Inc.