Overview

In this article, we will show how to set breakpoints within XCode to verify the events received by the remote command from the Firebase tag within Tealium IQ. We will also show how they are then sent to the Firebase SDK from the remote command. For this example, we will use the Firebase Sample App available for download from Github. You can use these same steps to test in your own app. These instructions cover every step from the beginning using our sample app, so if you are using your own app for this testing, please jump down to the "Testing Your App" section.

Get Started

For this tutorial, you will need the following downloaded/installed on your computer.

Initial App Configuration

In this section, we will be configuring the sample app and installing CocoaPods as well as the PLIST file from Firebase. Once this setup is complete, we will build the app and check for any errors that need to be resolved.

  1. Install CocoaPods to the app using Terminal
    1. Open the Terminal application (Terminal.app on Mac)
    2. If you haven't already done so, enable CocoaPods by running the following command in Terminal:
      $ sudo gem install cocoapods
      Wait for it to finish before proceeding.
    3. Find the project director in the Finder and take note of the path. This should be the parent folder of the Xcode project (.xcodeproj).
    4. Type the path into the terminal. For example:
      cd /Users/<yourname>/Documents/mobile/tealium/firebase/
    5. Press "return" to execute the command.
    6. Install the pods to your project by typing the following into the Terminal:
      $ pod install
      Wait for the command to finish processing, as it could take some time. If you open your project and receive errors related to CocoaPods, try installing again to ensure you're installing to the correct directory.

     

  2. Download and add the PLIST file to the project
    1. In your web browser, navigate to firebase.google.com (log in) and click on the "Go To Console" button.
    2. Click on the project you need the PLIST file from.
    3. In the left menu, click on the sprocket next to the "Project Overview" link.
    4. In the "Your Apps" section, you should see a button to download the PLIST file.

      testingfirebase-plist.jpg

    5. In the "TealiumFirebaseExample" folder of the file you downloaded from Github, open the following file in XCode:
      TealiumFirebaseExample.xcworkspace
    6. Find the PLIST file that was downloaded from Firebase and drag it into your project so that it's the first item in the list under the project filename.

      Screen Shot 2020-12-28 at 4.31.21 PM.png

     

  3. Build your app and check for any errors
    1. In the top left of your project, click on the white "PLAY" button to build your project.

      Screen Shot 2020-12-28 at 4.31.09 PM.png

    2. If there are any errors with the build, it will show you in the console so they can be corrected before moving to the next step.
    3. If the build is a success, you should see the simulator display with your app loaded (see image above).

Testing In The App

In order to test, we are going to trigger an event that is meant to be captured by Firebase, so if you're testing in your own app it's important to test on a screen where that event is present (ex: a login click). We will set breakpoints in the remote command to intercept the event coming from the Firebase tag and then track it through the remote command to the final code that sends the event to the Firebase SDK.

  1. Update an event to send to Tealium IQ (Sample App ONLY)
    Since we're using the sample app, we need to update the event in the app to match the event being captured by the Firebase tag. For this example, we will replace the event associated with the "Login" button on the home screen of the sample app.
    1. Find the “ViewControllers” folder, listed in the “TealiumFirebaseExample” folder within the main project.
    2. Click on the following file to open it on the right side:
      LoginViewController.swift
    3. The bottom box (screenshot below) is where the payload variables are defined. Any variable used in the event needs to be defined here first or you will receive an error. Populate the list with all of the variables you need to send.
    4. The top box (screenshot below) is where the trackEvent() call is being made. Update the payload with the variables you want to send (that you added in the bottom box). An example of a data value looks like this:
      
LoginViewController.ContentType: “Other"
    5. Click on the “Play” button in the top left corner to re-build your app and verify that the event data is coming through properly.
    6. To verify the event, click on the “Login” button in the app in the simulator and you should see an event come through in the console log.

      testingfirebase-event.jpg

     

  2. Update the Account/Profile to point to the account/profile used in your app (Sample App ONLY)
    To verify your Firebase in TealiumIQ is working correctly, you can update the account/profile/env information to use the account you’re testing.
    1. In the “TealiumFirebaseExample” folder within your project, click on the following file:

      TealiumHelper.swift
    2. Update the TealiumConfiguration object to use the information needed.
    3. Build the app once more so you can test everything in preparation for the next step.

     

  3. Set breakpoints to view the payload coming from the Firebase Tag
    This command is what the app has received from Tealium IQ before being parsed for Firebase. This is a good breakpoint to set to verify the data coming from the Firebase tag.
    1. In the “Pods” file, open the following path: 

      Pods > Development Pods > TealiumFirebase
    2. Set a breakpoint on line 40
    3. Click on the “Login” button in the app (Sample App ONLY) or trigger the event from your app. The code should break at your breakpoint.
    4. You can hover over the firebaseCommands and payload variables to see what is being captured from the Firebase tag.

      Screen Shot 2020-12-28 at 4.29.39 PM.png

     

  4. Set breakpoints to view the data sent to the Firebase SDK
    We set this breakpoint to set to see what final information is being sent to Firebase. If your code doesn't make it to the breakpoint, try setting other breakpoints at the beginning of the code block to see where it is breaking.
    1. In the “Pods” file, open the following path:
      
Pods > Development Pods > TealiumFirebase
    2. To test the logEvent command, set a breakpoint on line 87, or at the END of the switch case for the event you want to test.
    3. Click on the “Login” button in the app (Sample App ONLY) or trigger the event from your app. The code should break at your breakpoint.
    4. You can hover over eventName and normalizedParams to see what is being sent directly to Firebase.

      Screen Shot 2020-12-28 at 4.29.23 PM.png

Helpful Links

Google Firebase Documentation

Version history
Last update:
‎12-28-2020 05:08 PM
Updated by:
Public