Analytics
Central analytics class for tracking user behavior and application metrics.
Overview
This class provides a unified interface for logging events and user properties to multiple analytics providers including Firebase Analytics and AppMetrica. All tracking methods are static for easy access throughout the application.Key Features
- Event tracking with custom parameters
- User identification and property management
- Predefined event names and parameter keys
- Automatic logging to multiple analytics providers
Usage Examples
Basic Event Logging
// Simple event without parameters
Analytics.logEvent(Analytics.E_ONBOARD_STEP_DONE);
// Event with parameters
Bundle params = new Bundle();
params.putString(Analytics.P_STAGE, "welcome");
params.putLong(Analytics.P_DURATION, 5000);
Analytics.logEvent(Analytics.E_ONBOARD_STEP_DONE, params);
Content copied to clipboard
User Identification
// Set user ID for tracking
Analytics.setUserId("user_123");
// Set user properties
Analytics.setUserProperty("subscription_type", "premium");
Content copied to clipboard
Event Reference
| E_ONBOARD_STEP_DONE | User completes an onboarding step | P_STAGE, P_DURATION |
| E_DETECTION_SESSION | Doomscrolling session tracking | P_DURATION, P_COUNT |
| E_WARN1_SHOWN, E_WARN2_SHOWN | Warning dialogs shown to user | - |
| E_COOLDOWN_COMPLETED | User completes cooldown period | P_DURATION |
Best Practices
- Always use predefined event names and parameter keys when available
- Keep event names descriptive and consistent
- Use snake_case for all custom event names and parameters
- Be mindful of user privacy when logging potentially sensitive information
Author
DoomScrolling Team
Since
1.0
See also
Properties
Link copied to clipboard
Tracks when a cooldown is completed.
Link copied to clipboard
Tracks the ratio of completed cooldowns to started cooldowns.
Link copied to clipboard
Tracks doomscrolling session summary.
Link copied to clipboard
Tracks the ratio of actual doomscrolling sessions to total sessions.
Link copied to clipboard
Tracks the ratio of grace period usage to cooldown starts.
Link copied to clipboard
Tracks when the grace period is used.
Link copied to clipboard
Tracks when the grace period is used during lock.
Link copied to clipboard
Tracks when the app lock is started.
Link copied to clipboard
Tracks completion of onboarding steps.
Link copied to clipboard
Tracks when permissions are granted.
Link copied to clipboard
Tracks when permissions are revoked.
Link copied to clipboard
Tracks when the app is reopened within 2 minutes.
Link copied to clipboard
Tracks how often users reopen the app within 2 minutes of closing it.
Link copied to clipboard
Tracks when the background service is toggled on/off.
Link copied to clipboard
Tracks user response to the helpfulness survey.
Link copied to clipboard
Tracks when the helpfulness survey is shown.
Link copied to clipboard
Tracks user response to the intrusiveness survey.
Link copied to clipboard
Tracks when the intrusiveness survey is shown.
Link copied to clipboard
Tracks the global ratio of take rest actions to total popups shown.
Link copied to clipboard
Tracks user action after the first warning.
Link copied to clipboard
Tracks user response to the first warning (keep scrolling option).
Link copied to clipboard
Tracks when the first warning is shown to the user.
Link copied to clipboard
Tracks user response to the first warning (take rest option).
Link copied to clipboard
Tracks user action after the second warning.
Link copied to clipboard
Tracks user response to the second warning (keep scrolling option).
Link copied to clipboard
Tracks when the second warning is shown to the user.
Link copied to clipboard
Tracks user response to the second warning (take rest option).
Link copied to clipboard
Timestamp of when the app was installed
Link copied to clipboard
Number of times cooldown was successfully completed
Link copied to clipboard
Ratio of completed cooldowns to started cooldowns (cooldown_completed / cooldown_started)
Link copied to clipboard
Number of times cooldown was initiated
Link copied to clipboard
Number of days since the app was installed
Link copied to clipboard
Duration in milliseconds
Link copied to clipboard
Ratio of grace period usage to cooldown starts (grace_used / cooldown_started)
Link copied to clipboard
Number of times grace period was used
Link copied to clipboard
Ratio of reopens to take rest actions (reopen_within_2m / take_rest_clicked)
Link copied to clipboard
Number of times app was reopened within 2 minutes
Link copied to clipboard
Name of the survey being shown/answered
Link copied to clipboard
Number of times take rest button was clicked
Link copied to clipboard
Total number of times user chose to take rest
Link copied to clipboard
Global ratio of take rest actions to popups shown (take_rest_count / total_popups)
Link copied to clipboard
Total number of popups shown to the user
Link copied to clipboard
Total number of sessions tracked
Link copied to clipboard
Ratio of doomscrolling sessions to total sessions (true_doom_sessions / total_sessions)
Link copied to clipboard
Number of sessions identified as doomscrolling
Link copied to clipboard
Number of times user chose to keep scrolling after warning 1
Link copied to clipboard
Ratio of keep scrolling actions to warning 1 shown
Link copied to clipboard
Number of times warning 1 was shown to the user
Link copied to clipboard
Number of times user chose to take rest after warning 1
Link copied to clipboard
Ratio of take rest actions to warning 1 shown
Link copied to clipboard
Number of times user chose to keep scrolling after warning 2
Link copied to clipboard
Ratio of keep scrolling actions to warning 2 shown
Link copied to clipboard
Number of times warning 2 was shown to the user
Link copied to clipboard
Number of times user chose to take rest after warning 2
Link copied to clipboard
Ratio of take rest actions to warning 2 shown