Skip to content

GTM preview URL is not applied on UIScene cold start Body #50

Description

@mmyha

Description

After migrating our Flutter iOS app to the UIScene lifecycle, Mobile GTM Preview no longer works on cold start.

The preview URL is correctly delivered to:

scene(_:willConnectTo:options:)

and exists in connectionOptions.urlContexts.
We forward it using the documented API:
Analytics.handleOpen(context.url)
GTM logs that it processed the URL, but it still loads the saved container instead of the preview container.

  • Actual behavior
GoogleTagManager info: Loading container: GTM-XXXX
GoogleTagManager info: Attempting to load saved version of container GTM-XXXX
GoogleTagManager info: processing URL: tagmanager.c.<bundle-id>://preview/...
  • Expected behavior
GoogleTagManager info: Attempting to load preview container for GTM-XXXX

Workaround
Calling the private API +[TAGContainerLoader processURL:] before GTM container initialization makes the preview container load correctly.
We do not want to depend on this private API.

Environment
GoogleTagManager: 9.2.0
FirebaseAnalytics / GoogleAppMeasurement: 12.9.0
Flutter: 3.41.4
Xcode: 16.4
iOS: 18.5
Lifecycle: UIScene

Flutter integration details:

  • AppDelegate subclasses FlutterAppDelegate and implements FlutterImplicitEngineDelegate.
  • SceneDelegate subclasses FlutterSceneDelegate.
  • UIApplicationSceneManifest in Info.plist explicitly specifies the app's SceneDelegate, which subclasses FlutterSceneDelegate.
  • Flutter plugins are registered through GeneratedPluginRegistrant in didInitializeImplicitFlutterEngine(_:).
  • Firebase is initialized from Dart using FlutterFire:

Question
What is the supported public way to process a Mobile GTM preview URL before container loading during a UIScene cold start?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions