When you develop an app, being able to track analytics like app installations is incredibly helpful for mobile attribution, improving your app rank, or tracking campaigns. For that reason, companies have created tools that compile a bunch of useful data from your app, with one of the most successful being Google’s Firebase. While setting Firebase up takes some work, the wide variety of services and analytics it provides make it very worthwhile. This wikiHow article will teach you how to set up Firebase for your iOS app and use it to track new users.
Steps
-
Install Xcode and CocoaPods on your Apple computer. On the Apple computer you are using for app development, install Xcode 12.2 or later , then install CocoaPods 1.10.0 by running the command sudo gem install cocoapods in Terminal. [1] X Research source [2] X Research source
- Unfortunately, Xcode is only available for macOS. While it is possible to run Xcode using a virtual machine, it will certainly run more slowly than it would on a physical Mac, and VM-specific issues may arise that are difficult to debug.
- Be sure your app is designed for these operating system versions or later: iOS 10, macOS 10.12, tvOS 12, and watchOS 6.
-
Run your app on a physical or simulated Apple device. To test data collection and the functionality of your app as a whole, set up a physical Apple device or use a simulator.
- If you would like to use Cloud Messaging, a feature that allows you to receive notification and data payloads of up to 4,000 bytes, you have to run the app from a physical Apple device. [3] X Research source
Advertisement -
Sign into Firebase with a Google account. Signing in will take you to the Firebase console, where you will eventually be able to manage a number of settings and view analytics for your app.
-
Open the Firebase console and click Create a project . After opening the console , create a new project for your app with the white Create a project button.
-
Name your project and click Continue . Once you have typed in a name, click the blue Continue button to continue setting up your project.
-
Enable Google Analytics and click Continue . Google Analytics is necessary to track your app installs, so be sure to enable it before moving to the next step.
- In addition to tracking app installs, Google Analytics also provides a number of useful features including crash analytics, cloud messaging, A/B testing, and more.
-
Adjust your Analytics location and data sharing. Use the dropdown menu to select your country, then decide what Analytics data to share with Google by either accepting their default settings or changing it yourself by unchecking the blue checkbox.
-
Accept the Google Analytics terms and create your project. Click the blue checkbox to accept the Google Analytics terms, then press the blue Create project button.
-
Click Continue once your project is done loading. After you click the blue Continue button, you will be brought back to the Firebase console. The top of the page will now display the name of your project, and a variety of management options will appear on screen.
- Firebase has both a free model called the “Spark plan” and a pay-as-you-go model called the “Blaze plan”. Determine which is right for your app by comparing the features each plan offers .
-
Open the Firebase console and click iOS+ . When you open the console , click the white, circular button labelled iOS+ under “Get started by adding Firebase to your app”.
-
Find the bundle ID of your app in Xcode and enter it in the “Apple button ID” box. Your app bundle ID will be listed next to “Bundle Identifier” in the General tab of your app.
-
Enter a nickname and the App Store ID for your app. If you choose to enter a nickname for your app, it will be used to identify your app in your Firebase project. Including an App Store ID will allow Firebase Dynamic Links to send users to your app page on the App Store and Google Analytics to import and measure conversion events in Google Ads.
- Your App Store ID is the series of numbers after “id” at the end of your app’s URL.
- If your app does not have an App Store ID yet, you can input one later in your project settings.
-
Click Register app and download the config file. After clicking the blue Register app button, the next step will appear. Click the new Download GoogleService-Info.plist button to download the necessary config file.
-
Add the config file into your Xcode project. Move the “GoogleService-Info.plist” file into the root of your Xcode project.
-
Open a Terminal window and select the directory of the Xcode project for your app. To navigate to your project directory, move through higher level directories by typing cd (directory name) until you reach the folder containing your project’s directory, then type cd (project name) .
-
Create a Podfile through Terminal with pod init . Podfiles are used by CocoaPods, a dependency management software used by Firebase.
-
Open the Podfile and write pod ‘Firebase/Analytics’ , then save the file. This will import the Analytics software development kit (SDK), allowing you to track and manipulate data from your app.
- You can also add other supported Firebase SDKs from the list linked here .
-
Run pod install in the Terminal, then open your newly created .xcworkspace file with open (project name).xcworkspace . You should use the new “.xcworkspace” file for all future development on your app.
-
Import the Firebase module in your AppDelegate class. The Firebase module should be imported with import Firebase if you are coding in Swift or @import Firebase; if you are using Objective-C.
-
Configure an instance of FirebaseApp . For Swift users, do so with FirebaseApp.configure() ; for Objective-C users, write [FIRApp configure]; . Typically, these instances will be configured in your application:didFinishLaunchingWithOptions: method.
-
Verify your successful installation of Firebase by running your app. Once you have run the app, check the Firebase console to ensure you have installed Firebase correctly.
-
Open your Firebase project from the console. Go to the Firebase console , then open the project labeled with your app’s nickname.
-
Click Dashboard under “Analytics” on the sidebar. Once the Analytics Dashboard is open, you will see a variety of stats about user activity and engagement.
-
Find the graph titled “Users by App version” and filter it by user type. Click the arrow at the top right of the graph to open a dropdown menu that will allow you to make a graph detailing all users, new users, or returning users. The new users graph will show you how many users opened your app for the first time over a certain time period, essentially tracking new installations.
Expert Q&A
Tips
Expert Interview
Thanks for reading our article! If you’d like to learn more about dealing with mobile devices, check out our in-depth interview with Jessica Andzouana .
References
About This Article
1. Install Xcode and CocoaPods on your Apple computer, run your app on an Apple device, and sign into Firebase with a Google account.
2. Create a Firebase project for your app from the Firebase console.
3. Click the iOS+
button on the Firebase console and register your app.
4. Download the "GoogleService-Info.plist" config file and add it to the root of your Xcode project.
5. Create a Podfile through Terminal in the directory of your app project with pod init
.
6. Open your Podfile, write pod ‘Firebase/Analytics’
, save the file, and run pod install
in Terminal.
7. Run open (project name).xcworkspace
in Terminal, then import the Firebase module in your AppDelegate
class and configure an instance of Firebase App
.
8. Return to the Firebase console, then open the Analytics Dashboard and filter the "Users by App Version" graph to track your app installations.