top of page

3 simple methods to test Google Analytics 4 implementation in an iOS app

  • Writer: Michal Nováček
    Michal Nováček
  • Aug 9, 2024
  • 3 min read

Updated: Aug 12, 2024

In my previous post, I covered 3 testing methods for Android. Now, let’s turn our attention to iOS, the other major mobile platform. This post details 3 simple methods to test Google Analytics 4 implementation on iOS, including two methods that don’t require any developer assistance for setting up the testing environment. By the end, you’ll have the tools you need to confidently test iOS analytics implementation.


Table of contents


What you need


Method #1: Google Analytics 4 (Firebase) DebugView


Prerequisites:

Your developer needs to add the command line argument in Xcode, build and share the app version with you. I recommend including this argument in all future app versions so you can test the implementation in every future release. I also suggest adding this argument to non-production versions of the app, like testing or development versions.


Command line argument:

- FIRDebugEnabled

On this link is step-by-step guidance for developer how to setup command line argument.


Once the argument is implemented, app published, you can download the app and follow the steps.


Steps:

  1. Open Google Analytics 4 DebugView

  2. Open iOS mobile app and generate some hits - such as screen_view or try to tap on several elements.

  3. Hurray! You can see hits in GA4 debugView



Tip:

Some developers include a special menu in the development version of their app. You could ask them to add a switch that controls the argument values, allowing you to easily turn the debugView on or off as needed.



Method #2: Analytics Debugger for Apps by David Vallejo

Prerequisites:

  1. Install the desktop app: Analytics Debugger for Apps


Steps:


Turn off all VPNs on your computer and phone to prevent unexpected behaviour.


  1. Open Analytics Debugger for Apps

  2. Connect iPhone and computer to the same Wi-Fi

  3. Setup proxy in your iPhone

  4. Follow certificate installation in "HOW-TO VIDEO".

    1. Don't forget to trust certificate identity in Settings -> General -> Certificate Trust Settings

    2. This step is not shown in the video below because it's a one-time action (which is sufficiently explained in "HOW-TO-VIDEO"). Once you've completed the certificate installation on your device, there's no need to repeat it.

5. Open iOS mobile app and generate some hits - such as screen_view or try to tap on several elements.

6. View hits in Analytics Debugger for Apps



Consider supporting David Vallejo on GitHub. He is helping analytics community a lot.


Method #3: BigQuery

Prerequisites:

  1. Enable Export to BigQuery and allow export type “Streaming”.


2. Find your identifier. Basically there are two possible identifier you can filter by:

  • App Identifier: App Instance ID (generated by Firebase SDK for every app instance. When reinstall happens, new App Instance ID is assigned.)

  • User Identifier: Client User ID (for example generated after login or registration)


Steps to find App Instance ID:

  1. Follow Method #2

  2. Copy payload from Analytics Debugger for Apps

  3. Find App Instance ID (key app_instance_id) in copied payload. How to do it? Watch it in the video below.



4. Turn off the proxy on your iPhone. As manual proxy is setup, the hits are not shown in BigQuery.



Steps:

App Instance ID is being collected to column user_pseudo_id in BigQuery export.


  1. Copy payload

  2. Find your identifier.

    1. If you were using proxy to find App Instance ID from Method #2 turn off the proxy.

  3. Open Google Cloud Platform → Google BigQuery → Find your dataset → Streaming export ( _intraday tables)

  4. Replace values and run simple SQL query:

SELECT
  timestamp_micros(event_timestamp) as utc_timestamp,
  platform,
  event_name,
  event_params
FROM
  `<YOUR PROJECT NAME>.analytics_<YOUR DATASET ID>.events_intraday_<YOUR DATE IN FORMAT YYYYMMDD>`
WHERE
  user_pseudo_id = "<your_app_instance_id>"
ORDER BY
  1 DESC

5. Wohoo, you can see all collected hits from iOS mobile app.



If you want to filter by another identifier change, use this table to help identify the column:

Identifier

BigQuery column

Client User ID

user_id

App Instance ID

user_pseudo_id


Summary & personal experience

Based on personal experience, I've found that while GA4 DebugView is useful for quick checks, it sometimes has bugs and shouldn't be relied on entirely. It's important to verify data in BigQuery to ensure all necessary hits are accurately captured. Analytics Debugger for Apps is also helpful but may miss some hits that appear in BigQuery. Ultimately, BigQuery is the most dependable method for ensuring strong data quality, especially for validating client data. Using these methods in different scenarios has proven effective for testing GA4 implementations in mobile apps: rely on DebugView and Analytics Debugger for quick assessments, and use BigQuery for comprehensive data validation.

 
 
 

Comments


bottom of page