Application lifecycle

  • iOS
  • watchOS
  • tvOS
 

Foreword

Lifecycle variables allow you to know how users are using your application. With lifecycle variables, you can calculate, for example, user retention and the use rate of your application.

Lifecycle variables are automatically calculated and added in stc variable of your hits.

 

Example

Here’s an example of JSON added in the stc variable of your hits:

{
    "lifecycle": {
        "sessionId": "e1e04f45-8d54-4e24-81cf-75314a5bcead",
        "fs": 0,
        "fsau": 0,
        "sc": 5,
        "scsu": 2,
        "fsd": 20160120,
        "dsfs": 0,
        "fsdau": 20160120,
        "dsu": 0,
        "dsls": 0
    }
}
 

Metrics recovery (>= 2.11.1)

Since 2.11.1 version, it’s now possible to get metrics computed by SDK to do an other processing. To do this, just call tracker method :

let metrics = tracker.getLifecycleMetrics()
NSDictionary* metrics = [tracker getLifecycleMetrics];

Metrics are rendered in the same way as in the stc, so get it from the same key (sample with “sc” : session count):
let metrics = tracker.getLifecycleMetrics()
let sc = metrics["sc"] // get the session count
NSDictionary* metrics = [self.tracker getLifecycleMetrics];
NSObject* sc = [metrics objectForKey:@"sc"];

 

Variables

NameDescription
sessionIdThe session begins when an application is launched or brought into the foreground, and ends when the application is sent to the background during more than 60 seconds (by default), or when the application is closed.
fsAllows you to know if the application was launched for the first time
fsauAllows you to know if the application has been launched for the first time since an update
scNumber of sessions made from the application’s installation
scsuNumber of sessions made since the last application update
fsdDate of the application’s very first session
dsfsNumber of days since the very first session
fsdauDate of first session since the last update
dsuNumber of days since the last update
dslsThis variable indicates the number of days that have passed since the last session. The calculation is made using the phone’s settings. As such, if the user has changed the phone’s date, the variable may be a negative number.
 

Was this post helpful?

Last update: 08/03/2019