Skip to content

Analytics.setSessionTimeoutInterval() doesn't seem to work with GA4 #14929

Open
@apcnir

Description

@apcnir

Description

Summary

I'm using Analytics.setSessionTimeoutInterval() in my iOS app, but it doesn't seem to have any effect on session timeouts in GA4. The method runs without errors, but sessions still timeout at the default 30 minutes regardless of what value I pass in.

Expected Behavior

When calling Analytics.setSessionTimeoutInterval(customTimeout), GA4 should respect the custom session timeout duration for subsequent analytics sessions.

Actual Behavior

  • Method executes without errors
  • Session timeout remains at default 30 minutes regardless of the value passed
  • No apparent effect on session behavior in GA4 reporting

Questions

  • Does this method still work with GA4, or is it legacy from Universal Analytics?
  • If custom session timeouts aren't supported in GA4, what's the recommended approach?
  • Could the documentation clarify this behavior to help other developers?

Thanks for any guidance you can provide!

Reproducing the issue

Steps to Reproduce

  1. Initialize Firebase Analytics in iOS app in the didFinishLaunchingWithOptions delegate, using FirebaseApp.configure()
  2. Call immediately Analytics.setSessionTimeoutInterval(300) // 5 minutes
  3. Use the app briefly, then minimize it and leave it in the background for longer than 5 minutes
  4. Return to the app and trigger some analytics events
  5. Check GA4 DebugView, the events still show the same session ID, indicating the session didn't timeout at the specified interval

Code Sample

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
        FirebaseApp.configure()
        Analytics.setSessionTimeoutInterval(sessionTimoutInSeconds)
}

Firebase SDK Version

11.13.0

Xcode Version

16.3

Installation Method

CocoaPods

Firebase Product(s)

Analytics

Targeted Platforms

iOS

Relevant Log Output

11.13.0 - [FirebaseAnalytics][I-ACS024000] Debug mode is on
11.13.0 - [FirebaseAnalytics][I-ACS023007] Analytics v.11.13.0 started
11.13.0 - [FirebaseAnalytics][I-ACS023008] To disable debug logging set the following application argument: -noFIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
11.13.0 - [FirebaseAnalytics][I-ACS023009] Debug logging enabled
11.13.0 - [FirebaseAnalytics][I-ACS023207] To enable verbose logging set the following application argument: -FIRAnalyticsVerboseLoggingEnabled (see http://goo.gl/RfcP7r)
11.13.0 - [FirebaseAnalytics][I-ACS044000] GoogleAppMeasurementIdentitySupport dependency is linked.
11.13.0 - [FirebaseAnalytics][I-ACS044001] The AdSupport Framework is linked.
11.13.0 - [FirebaseAnalytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
11.13.0 - [FirebaseAnalytics][I-ACS002002] APMExperimentAlarm scheduled to fire in approx. (s): 1033.189889907837
11.13.0 - [FirebaseAnalytics][I-ACS029014] Successfully parsed a configuration. Version: [CONFIG_VERSION]
11.13.0 - [FirebaseAnalytics][I-ACS023016] Analytics is ready to receive events
11.13.0 - [FirebaseAnalytics][I-ACS032014] AdServices framework is not linked. Search Ad Attribution Reporter is disabled.
11.13.0 - [FirebaseAnalytics][I-ACS023012] Analytics collection enabled
11.13.0 - [FirebaseAnalytics][I-ACS023171] Resetting App Measurement data
11.13.0 - [FirebaseAnalytics][I-ACS002003] APMExperimentAlarm canceled
11.13.0 - [FirebaseAnalytics][I-ACS002002] APMExperimentAlarm scheduled to fire in approx. (s): 0.001
11.13.0 - [FirebaseAnalytics][I-ACS023168] Analytics data has been reset
11.13.0 - [FirebaseAnalytics][I-ACS002001] APMExperimentAlarm fired
11.13.0 - [FirebaseAnalytics][I-ACS002003] APMExperimentAlarm canceled
11.13.0 - [FirebaseAnalytics][I-ACS023087] User property set. Name, value: first_open_after_install (_fi), 1
11.13.0 - [FirebaseAnalytics][I-ACS023087] User property set. Name, value: first_open_time (_fot), [TIMESTAMP]
11.13.0 - [FirebaseAnalytics][I-ACS023051] Logging event: origin, name, params: auto, first_open (_f), {
    ga_event_origin (_o) = auto;
    previous_first_open_count (_pfo) =;
    previous_gmp_app_id (_pgmp) = [PREVIOUS_APP_ID];
    update_with_analytics (_uwa) = 0;
}
11.13.0 - [FirebaseAnalytics][I-ACS023073] Debug mode is enabled. Marking event as debug and real-time. Event name, parameters: first_open (_f), {
    ga_conversion (_c) = 1;
    ga_debug (_dbg) = 1;
    ga_event_origin (_o) = auto;
    ga_realtime (_r) = 1;
    previous_first_open_count (_pfo) = [COUNT];
    previous_gmp_app_id (_pgmp) = [PREVIOUS_APP_ID];
    update_with_analytics (_uwa) = 0;
}
11.13.0 - [FirebaseAnalytics][I-ACS023072] Event logged. Event name, event params: first_open (_f), {
    ga_conversion (_c) = 1;
    ga_debug (_dbg) = 1;
    ga_event_origin (_o) = auto;
    ga_realtime (_r) = 1;
    previous_first_open_count (_pfo) = [COUNT];
    previous_gmp_app_id (_pgmp) = [PREVIOUS_APP_ID];
    update_with_analytics (_uwa) = 0;
}
11.13.0 - [FirebaseAnalytics][I-ACS023051] Logging event: origin, name, params: auto, user_engagement (_e), {
    engagement_time_msec (_et) = 1;
    ga_event_origin (_o) = auto;
}
11.13.0 - [FirebaseAnalytics][I-ACS023073] Debug mode is enabled. Marking event as debug and real-time. Event name, parameters: user_engagement (_e), {
    engagement_time_msec (_et) = 1;
    ga_debug (_dbg) = 1;
    ga_event_origin (_o) = auto;
    ga_realtime (_r) = 1;
}
11.13.0 - [FirebaseAnalytics][I-ACS023072] Event logged. Event name, event params: user_engagement (_e), {
    engagement_time_msec (_et) = 1;
    ga_debug (_dbg) = 1;
    ga_event_origin (_o) = auto;
    ga_realtime (_r) = 1;
}
11.13.0 - [FirebaseAnalytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): -0.8385238647460938

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

PODS:
  - FirebaseABTesting (11.13.0):
    - FirebaseCore (~> 11.13.0)
  - FirebaseAnalytics (11.13.0):
    - FirebaseAnalytics/AdIdSupport (= 11.13.0)
    - FirebaseCore (~> 11.13.0)
    - FirebaseInstallations (~> 11.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 8.1)
    - GoogleUtilities/MethodSwizzler (~> 8.1)
    - GoogleUtilities/Network (~> 8.1)
    - "GoogleUtilities/NSData+zlib (~> 8.1)"
    - nanopb (~> 3.30910.0)
  - FirebaseAnalytics/AdIdSupport (11.13.0):
    - FirebaseCore (~> 11.13.0)
    - FirebaseInstallations (~> 11.0)
    - GoogleAppMeasurement (= 11.13.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 8.1)
    - GoogleUtilities/MethodSwizzler (~> 8.1)
    - GoogleUtilities/Network (~> 8.1)
    - "GoogleUtilities/NSData+zlib (~> 8.1)"
    - nanopb (~> 3.30910.0)
  - FirebaseCore (11.13.0):
    - FirebaseCoreInternal (~> 11.13.0)
    - GoogleUtilities/Environment (~> 8.1)
    - GoogleUtilities/Logger (~> 8.1)
  - FirebaseCoreExtension (11.13.0):
    - FirebaseCore (~> 11.13.0)
  - FirebaseCoreInternal (11.13.0):
    - "GoogleUtilities/NSData+zlib (~> 8.1)"
  - FirebaseCrashlytics (11.13.0):
    - FirebaseCore (~> 11.13.0)
    - FirebaseInstallations (~> 11.0)
    - FirebaseRemoteConfigInterop (~> 11.0)
    - FirebaseSessions (~> 11.0)
    - GoogleDataTransport (~> 10.0)
    - GoogleUtilities/Environment (~> 8.1)
    - nanopb (~> 3.30910.0)
    - PromisesObjC (~> 2.4)
  - FirebaseInstallations (11.13.0):
    - FirebaseCore (~> 11.13.0)
    - GoogleUtilities/Environment (~> 8.1)
    - GoogleUtilities/UserDefaults (~> 8.1)
    - PromisesObjC (~> 2.4)
  - FirebasePerformance (11.13.0):
    - FirebaseCore (~> 11.13.0)
    - FirebaseInstallations (~> 11.0)
    - FirebaseRemoteConfig (~> 11.0)
    - FirebaseSessions (~> 11.0)
    - GoogleDataTransport (~> 10.0)
    - GoogleUtilities/Environment (~> 8.1)
    - GoogleUtilities/MethodSwizzler (~> 8.1)
    - GoogleUtilities/UserDefaults (~> 8.1)
    - nanopb (~> 3.30910.0)
  - FirebaseRemoteConfig (11.13.0):
    - FirebaseABTesting (~> 11.0)
    - FirebaseCore (~> 11.13.0)
    - FirebaseInstallations (~> 11.0)
    - FirebaseRemoteConfigInterop (~> 11.0)
    - FirebaseSharedSwift (~> 11.0)
    - GoogleUtilities/Environment (~> 8.1)
    - "GoogleUtilities/NSData+zlib (~> 8.1)"
  - FirebaseRemoteConfigInterop (11.13.0)
  - FirebaseSessions (11.13.0):
    - FirebaseCore (~> 11.13.0)
    - FirebaseCoreExtension (~> 11.13.0)
    - FirebaseInstallations (~> 11.0)
    - GoogleDataTransport (~> 10.0)
    - GoogleUtilities/Environment (~> 8.1)
    - GoogleUtilities/UserDefaults (~> 8.1)
    - nanopb (~> 3.30910.0)
    - PromisesSwift (~> 2.1)
  - FirebaseSharedSwift (11.13.0)
  - GoogleAppMeasurement (11.13.0):
    - GoogleAppMeasurement/AdIdSupport (= 11.13.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 8.1)
    - GoogleUtilities/MethodSwizzler (~> 8.1)
    - GoogleUtilities/Network (~> 8.1)
    - "GoogleUtilities/NSData+zlib (~> 8.1)"
    - nanopb (~> 3.30910.0)
  - GoogleAppMeasurement/AdIdSupport (11.13.0):
    - GoogleAppMeasurement/WithoutAdIdSupport (= 11.13.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 8.1)
    - GoogleUtilities/MethodSwizzler (~> 8.1)
    - GoogleUtilities/Network (~> 8.1)
    - "GoogleUtilities/NSData+zlib (~> 8.1)"
    - nanopb (~> 3.30910.0)
  - GoogleAppMeasurement/WithoutAdIdSupport (11.13.0):
    - GoogleUtilities/AppDelegateSwizzler (~> 8.1)
    - GoogleUtilities/MethodSwizzler (~> 8.1)
    - GoogleUtilities/Network (~> 8.1)
    - "GoogleUtilities/NSData+zlib (~> 8.1)"
    - nanopb (~> 3.30910.0)
  - GoogleDataTransport (10.1.0):
    - nanopb (~> 3.30910.0)
    - PromisesObjC (~> 2.4)
  - GoogleUtilities/AppDelegateSwizzler (8.1.0):
    - GoogleUtilities/Environment
    - GoogleUtilities/Logger
    - GoogleUtilities/Network
    - GoogleUtilities/Privacy
  - GoogleUtilities/Environment (8.1.0):
    - GoogleUtilities/Privacy
  - GoogleUtilities/Logger (8.1.0):
    - GoogleUtilities/Environment
    - GoogleUtilities/Privacy
  - GoogleUtilities/MethodSwizzler (8.1.0):
    - GoogleUtilities/Logger
    - GoogleUtilities/Privacy
  - GoogleUtilities/Network (8.1.0):
    - GoogleUtilities/Logger
    - "GoogleUtilities/NSData+zlib"
    - GoogleUtilities/Privacy
    - GoogleUtilities/Reachability
  - "GoogleUtilities/NSData+zlib (8.1.0)":
    - GoogleUtilities/Privacy
  - GoogleUtilities/Privacy (8.1.0)
  - GoogleUtilities/Reachability (8.1.0):
    - GoogleUtilities/Logger
    - GoogleUtilities/Privacy
  - GoogleUtilities/UserDefaults (8.1.0):
    - GoogleUtilities/Logger
    - GoogleUtilities/Privacy
  - nanopb (3.30910.0):
    - nanopb/decode (= 3.30910.0)
    - nanopb/encode (= 3.30910.0)
  - nanopb/decode (3.30910.0)
  - nanopb/encode (3.30910.0)
  - PromisesObjC (2.4.0)
  - PromisesSwift (2.4.0):
    - PromisesObjC (= 2.4.0)

DEPENDENCIES:
  - FirebaseAnalytics
  - FirebaseCrashlytics
  - FirebasePerformance

SPEC REPOS:
  trunk:
    - FirebaseABTesting
    - FirebaseAnalytics
    - FirebaseCore
    - FirebaseCoreExtension
    - FirebaseCoreInternal
    - FirebaseCrashlytics
    - FirebaseInstallations
    - FirebasePerformance
    - FirebaseRemoteConfig
    - FirebaseRemoteConfigInterop
    - FirebaseSessions
    - FirebaseSharedSwift
    - GoogleAppMeasurement
    - GoogleDataTransport
    - GoogleUtilities
    - nanopb
    - PromisesObjC
    - PromisesSwift

COCOAPODS: 1.15.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions