Skip to content

Latest commit

 

History

History
87 lines (52 loc) · 3.15 KB

README.md

File metadata and controls

87 lines (52 loc) · 3.15 KB

GTM mobile sample app

This project is an example to configure GTM (Google Tag Manager) on app. Also, is an example to log event to GA4 (Google Analytics 4)

Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Perquisites

  1. Please refer to this link to set up 2 GTM container and relevant tags
  1. Download the selected container version (GTM-XXXXXXXX.json) and place them under app/src/main/assets/containers/GTM-XXXXXX.json folder (android) and PROJECT_ROOT/container/GTM-XXXXXX.jsonfolder (iOS)

Local development

To start developing locally, please follow the below steps

  1. Clone the git repository and install the flutter packages.

    flutter pub get
  2. Log into Firebase using your Google account with the below command. (It require to install the Firebase CLI)

    firebase login 
  3. Install the FlutterFire CLI with the following command.

    (You may need to add the path of Pub to your shells' config file. Please follow the response of the command to add the path.)

    dart pub global activate flutterfire_cli
  4. Run the below command to configure the apps to connect to Firebase.

    flutterfire configure

    You may need to manually download the GoogleService-info.plist file from Firebase console. And put it in ios/Runner. Check the folder position in Xcode and rebuild it if needed.

  5. Run the flutter application

    flutter run

    Or Open VS code to and use Run and Debug to run the application

Enable Debug mode

iOS

Go Product -> Edit Scheme -> Run -> Arguments. Add 2 arguments -FIRAnalyticsDebugEnabled and -FIRDebugEnabled

Android

To enable Analytics debug mode on an Android device, execute the following commands: (You may need to install adb first)

adb shell setprop debug.firebase.analytics.app com.example.gtm_mobile_sample_app

This behavior persists until you explicitly disable debug mode by executing the following command:

adb shell setprop debug.firebase.analytics.app .none.

References