Integrating Amplitude into your app can give you insights into how users are interacting with your app and what features are driving your retention. Various open source SDKs are available depending on your app, but first let’s go through some of the important customizations you’ll need to make.
If you already know all about how Amplitude tracks events, users, and sessions, then scroll down to the end to start the installation. If not, read on!
What Does The Amplitude SDK Do?
Amplitude’s open source SDK integrates with your app to transmit user behavior and the context around that behavior back to Amplitude for analysis. That includes:
- Event tracking that follows users’ actions and completion of set milestones
- Information like app version, phone model, operating system version, and carrier information to drive lead retention
- Tracking revenue to optimize advertising campaigns
Before You Begin
Every app needs a unique SDK, and there are many choices to be made when deciding how to customize yours. The first choice is what questions do you want to answer? Setting goals for how integrating Amplitude will help you increase customer retention will set the structure for what user actions you need.
These are a few questions you should ask yourself to get started:
- What events correspond with your business goals? These goals shape the company and metrics that you care about measuring. You should be aligning and tracking events that work towards these goals.
- Do you need cross-platform instrumentation? If your application is available on multiple platforms, you’ll need to decide on how to process the data. If your focus is on differentiating how users interact on different platforms, then you won’t need to track users outside of each individual platform. If you’re more interested in overall user behavior, then you’ll want to be able to track if users move from one platform to another via cross-platform tracking.
- How are users identified and how will this give insights into user behavior? Especially when tracking users across multiple platforms, you need to make a conscious decision on how you configure user identification. You also need to be aware of potential user tracking complications to ensure that you collect data that accurately reflects behavior.
The three basic units of mobile analytics are events, users, and sessions. Let’s go into a bit more detail on each because Amplitude uses these terms in a specific way. You’ll want to be familiar with each one before you dive into the SDK for your platform.
Amplitude is an event-based analytics platform, so strategically choosing which events to send can determine whether you get the full value from your data.
Events are defined as user actions taken within your app. Depending on how you define them, events can be anything from the pushing of a button, the processing of a payment, or the tapping of the screen in a certain region of pixels.
Your business goals should be the foundation for any decisions you make. Here are a few tips to follow when choosing events:
- Determine Event and User Properties: Properties are specific attributes of events or users that can be measured. For example you may want to determine how much of your onboarding video new users watch before clicking away or moving to the next step. This is defined as an event property and can be tracked.
- Make sure you organize events and related properties. Once you start adding more and more events and their corresponding properties it can get very complicated very fast. Keeping an organized spreadsheet will make sure you have something you and your team can refer back to. You can download the Event Taxonomy Template here to help you get started.
Most importantly, don’t start tracking everything at once. Prioritize your events and start with the most important ones first. By focusing on the events that provide the most value, you can make the most of your time and then add in more events as your business and user base grows.
There are three different terms used to refer to users. They help determine the type of user and how their actions are recorded in the data.
- Active User: A user who has logged at least one action on a particular day.
- New User: A user who has logged an action for the first time.
- Unique User: A distinct individual to which actions are attributed. Properly tracking unique users will ensure that you are collecting accurate data.
Unique users are given and identified by an amplitude_id which is used throughout Amplitude dashboards. This amplitude_id is determined by gathering device_id and user_id information.
- device_id: This is determined by the IDFV of the device and ensures that within a specific device, the identification for each unique user won’t change. You can also choose to use the Advertising Identifier (IDFA for iOS and ADID for Android), which persists across all installs on multiple devices. It is useful for tracking users across different devices, giving information on cross-device usage and retention. The downside is that this Identifier can be changed if users limit ad tracking, creating a completely new unique user.
- user_id: Set to a specific identifier for each user. You can choose to use username, email address or any other internal unique identifier. However if the identifier is changed a new user_id is assigned, so it’s best to use something that is not likely to change.
When assigning an amplitude_id to an event, user_id is prioritized over device_id. Specific examples of this can be seen here.
A session is a period of time that a user has your app in the foreground. The default setting groups sessions within five minutes of each other into a single session.
The default settings for tracking sessions include:
- Starting a new session when the app is launched in the foreground
- Creating a new session if the app comes back into the foreground after five minutes of being in the background
- Logging a new session if an event is recorded while the app is in the background after five minutes
These settings can be changed to more accurately reflect the average usage of your app. For example if your app sends users periodic push notifications that they have to clear by opening the app, that would count as a new session. To present a more accurate picture of app usage, you can log these events as out of session by changing the parameters.
Now that you see the structure of Amplitude’s SDK, here are some basic principles of data and testing to keep in mind as you go about integrating Amplitude with your app.
- Keep test and production data separate. It’s good practice to test every feature out fully to filter for potential issues before integrating it into your actual app. This ensures you don’t corrupt your data with faulty code.
- Keep mobile and web separate as well. Just like you wouldn’t use the same code to implement your app on mobile and web, you also shouldn’t be using the same instrumentation across the board. Your users will also be interacting with your mobile and web apps differently and you need to account for that in your SDK design.
- Don’t get ahead of yourself. Each event or user shouldn’t have more than 20 associated properties. Any more and you should be making a new event instead.
When you’re ready, click through to the Github page for your platform’s SDK, clone it, and get going!
For more on setting up, launching, and making your mobile app sticky, check out our Mobile Analytics resource page.
photo credit: Death to the Stock Photo