Existing Users Setup
When you already have an existing user base, you should include a firstSeen timestamp so your analytics reflect when users first installed your app. Especially if you have a large existing userbase. This allows the devgrowthlab service to correct model your apps retention curve. Below are the recommended ways to detect the first install time per platform.
1. Add a firstSeen field
Section titled “1. Add a firstSeen field”Send the first install timestamp along with your ingestion requests:
{ "firstSeen": 1760399940, "lastToken": ..., "cohorts": ...}firstSeen: a Unix timestamp (seconds or milliseconds since epoch) representing the first time the user had the app installed.- This allows the service to correctly model the retention curve for your app.
2. Platform-specific detection
Section titled “2. Platform-specific detection”import android.content.pm.PackageManager
// Retrieve first install time from PackageManagerval packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)val firstSeen = packageInfo.firstInstallTimeimport Foundation
if let appPath = Bundle.main.bundlePath as String? { let attributes = try? FileManager.default.attributesOfItem(atPath: appPath) if let creationDate = attributes?[.creationDate] as? Date { let firstSeen = Int(creationDate.timeIntervalSince1970) }}import 'package:device_info_plus/device_info_plus.dart';import 'dart:io';
Future<int> getFirstSeen() async { final deviceInfo = DeviceInfoPlugin(); DateTime firstInstall;
if (Platform.isAndroid) { final androidInfo = await deviceInfo.androidInfo; firstInstall = DateTime.fromMillisecondsSinceEpoch(androidInfo.firstInstallTime ?? 0); } else if (Platform.isIOS) { // Use the bundle folder creation date as an approximation firstInstall = DateTime.now(); // fallback if detection fails }
return firstInstall.millisecondsSinceEpoch;}3. Send events with firstSeen
Section titled “3. Send events with firstSeen”Include the firstSeen timestamp in your ingestion requests:
{ "firstSeen": 1760399940, "lastToken"...}4. Ship the code for a month or two
Section titled “4. Ship the code for a month or two”There’s no need to keep this code in your app long term, include it initially for a month or two, once your existing users have updated then its safe to remove the code. Just ensure you continue to send the last token in the API requests as this is usually how devgrowthlab keeps track of users’ tenure.
This ensures your analytics reflect the true install time for existing users, and avoids counting them as new users the next time the user opens the app.