/firebase-tutorials

How to integrate Firebase with Google Tag Manager?

Learn how to integrate Firebase with Google Tag Manager in a few simple steps. Set up Firebase, add analytics tags in GTM, and test your integration effectively.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to integrate Firebase with Google Tag Manager?

 

Step 1: Set Up Firebase in Your Project

 

Ensure that you have a Firebase project set up. If not, create a new Firebase project in the Firebase console.

  1. Open the Firebase console.
  2. Click on "Add project" and follow the instructions to create your project.
  3. Once your project is created, navigate to the Firebase dashboard.

 

Step 2: Add Firebase to Your App

 

Depending on whether you are working on an Android or an iOS app, the process of adding Firebase will be slightly different.

For Android:

  • Add the Firebase SDK to your project using the following steps:

  • Open your build.gradle file (project level) and add the Google Services classpath:

    
      buildscript {
          dependencies {
              // Add this line
              classpath 'com.google.gms:google-services:4.3.8'
          }
      }
      
  • Open your build.gradle file (app level) and apply the Google Services plugin:

    
      apply plugin: 'com.android.application'
      apply plugin: 'com.google.gms.google-services'
      
  • Add Firebase dependencies to your app's build.gradle:

    
      dependencies {
          // Add these lines
          implementation platform('com.google.firebase:firebase-bom:30.1.0')
          implementation 'com.google.firebase:firebase-analytics'
      }
      

For iOS:

  • Add the Firebase SDK to your app using CocoaPods:

  • Add the Firebase pod to your Podfile:

    
      platform :ios, '10.0'
    
      target 'YourAppTarget' do
        use\_frameworks!
    
        # Add the Firebase pod for Google Analytics
        pod 'Firebase/Analytics'
      end
      
  • Install the pods by running the following command in your terminal:

    
      pod install
      

 

Step 3: Set Up Google Tag Manager Container

 

  1. Navigate to the Google Tag Manager dashboard.
  2. Click on "Add a new container".
  3. Enter your container name, select the container type (iOS or Android), and click "Create".

 

Step 4: Add Firebase Analytics Tag in Google Tag Manager

 

  1. In the Google Tag Manager console, click "New Tag".
  2. Choose "Tag Configuration" and select "Firebase Analytics Event".
  3. Under "Configure Tag", enter the event name and parameter settings you wish to log.
  4. Set up the trigger for the tag (e.g., when a specific event occurs in your app).
  5. Name your tag and click "Save".

 

Step 5: Link Firebase Analytics to Google Tag Manager

 

For the integration between Google Tag Manager and Firebase, you must ensure Firebase Analytics SDK is correctly installed as it acts as the intermediary for sending data.

  • Ensure your Firebase has Google Analytics enabled:

  • Navigate to Firebase console.

  • Go to 'Analytics' from the side menu.

  • Ensure Google Analytics is enabled.

  • Validate Event Triggering:

  • Ensure that required events and triggers are properly set in Google Tag Manager.

  • Check if the data flows as expected by using the "Preview" mode in Google Tag Manager.

 

Step 6: Deploy Your Changes

 

  1. Once your setup is done and validated, click "Submit" in Google Tag Manager.
  2. Enter a name and description for your version and click "Publish".
  3. Confirm and publish your container to make the changes live.

 

Step 7: Test the Integration

 

  1. Monitor events in the Firebase console to ensure they are arriving as expected.
  2. Use Firebase DebugView to verify events in real time.

By following these steps, you should be able to successfully integrate Firebase with Google Tag Manager and start managing analytics from within the Tag Manager interface.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022