Last modified January 14, 2021 by Shelly Wolfe

How do I configure the New Session Interval?

Swrve treats an app session as a new session if the user returns to the app after having left it for 30 seconds, by default. However, you can configure the new session interval of 30 seconds using the newSessionInterval config property. You may want to extend it to several minutes to facilitate users taking longer breaks from the app, without incrementing session counts. For more details on how to customize this setting, click the relevant tab below.

iOS

Customizing the new session interval in the native iOS SDK requires at least v4.0.1 of the iOS SDK. For the latest version of the iOS SDK, see iOS SDK release notes.

In iOS, the newSessionInterval is measured in seconds. Update the didFinishLaunchingWithOptions method of your application with the following, and substitute 30 with the value of your choice.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
SwrveConfig* config = [[SwrveConfig alloc] init];
config.newSessionInterval = 30; // seconds
[Swrve sharedInstanceWithAppID:<app_id> apiKey:@"<api_key>" config:config];
...
}
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { SwrveConfig* config = [[SwrveConfig alloc] init]; config.newSessionInterval = 30; // seconds [Swrve sharedInstanceWithAppID:<app_id> apiKey:@"<api_key>" config:config]; ... }
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  SwrveConfig* config = [[SwrveConfig alloc] init];
  config.newSessionInterval = 30;    // seconds

  [Swrve sharedInstanceWithAppID:<app_id> apiKey:@"<api_key>" config:config];
...
}

Android

Unity

Roku