Using Firebase in React Native Expo to trigger a Google Ads Conversion?

147 views
Skip to first unread message

FixFox

unread,
Jul 25, 2024, 9:38:18 AM7/25/24
to Firebase Google Group
I am looking for a way to get Firebase working in an app built in React Native Expo, so that it gives out some sort of data for Google Ads to use and count as a conversion metric, when someone installs our iOS app by way of clicking on a Google Ad served to them.

It's shocking that Google hasn't made this easier, but there is currently no way of measuring Google Ads Conversions for an App Install campaign, without using Firebase.

I have been working with Google Ads support over the past month, and they have been unable to help me. So according to Google Ads support, the only way to count conversion metrics for iOS installs is to use Firebase embedded in our app to get some data out of the app once it's installed by an end user. Or some other 3rd party tool that they are unable to recommend or support.  

Jared Parr

unread,
Jul 26, 2024, 11:15:51 AM7/26/24
to Firebase Google Group
​Hi FixFox,

Thanks for your question about integrating Firebase into your React Native Expo app to track Google Ads conversions for iOS installs. I know it can be frustrating when these things aren't as straightforward as they should be, but don't worry, we'll try to get it sorted out! Please note, I am not sure if this will fix your problem, but I hope to at least try!  

// App.js
import React, { useEffect } from 'react';
import { View, Text } from 'react-native';
import { getAnalytics, logEvent } from 'expo-firebase-analytics';

export default function App() {
  useEffect(() => {
    // Initialize analytics and log an event when the app is opened
    const analytics = getAnalytics();
    logEvent(analytics, 'app_open');
  }, []); // Empty dependency array ensures this runs only on the first render

  return (
    <View>
      <Text>Your app content goes here</Text>
    </View>
  );
}

Here's what you'll need to do: First, make sure you have the expo-firebase-analytics package installed in your project. If you haven't already, run expo install expo-firebase-analytics in your project directory.
  1. In your App.js file, import useEffect from React, and getAnalytics and logEvent from expo-firebase-analytics.
  2. Inside your App component, use a useEffect hook to initialize the Firebase analytics and log an app_open event. The empty dependency array [] ensures that this code runs only once when the component mounts.
  3. Set up a conversion event in your Google Ads account that matches the app_open event. This tells Google Ads to count this Firebase event as a conversion.
  4. Ensure your Firebase project is properly set up and connected to your Google Ads account. You'll need to provide your Firebase project credentials in your Expo app's configuration.

With this setup, Firebase will log the app_open event whenever a user installs your app from a Google Ad and opens it, and Google Ads will count it as a conversion. For better code organization and performance, consider moving the analytics initialization logic into a separate custom hook or a dedicated analytics module. This allows you to easily reuse it across your app and keeps your components clean.

Let me know if I can be of further help,

Jared Parr, (he/him)

Google Cloud Partner
513-270-4050 Office

Google for Developers
Google Cloud Certified, Associate Cloud Engineer

Google Cloud Certified, Professional


Reply all
Reply to author
Forward
0 new messages