adding user_id in event parameter

Hi there, 

I wonder if we're able to add user_id in event parameter? It sends via GTM.  However, i got "undefined" value in the raw data in BQ.  Could it be user_id is a reserved name and can't be used anywhere else?

sysph_2-1711644223924.png

Here's my settings in GTM

 

sysph_0-1711644116232.png

Initially, i didn't set up default value for user_id. 

sysph_1-1711644138253.png

Thanks in advance

 

Solved Solved
0 1 201
1 ACCEPTED SOLUTION

Hi @sysph ,

Yes, you can add user_id as a custom event parameter in Google Cloud Firebase through Google Tag Manager (GTM), and ideally, its value should not appear as "undefined" in BigQuery. Let's explore some refined troubleshooting steps to address this issue:

Troubleshooting Steps

User-ID Association

  • App Implementation: Ensure the user ID is correctly set in your app's code using the setUserId() method for mobile apps or through the user_id parameter in the Firebase config (gtag('config', 'GA_MEASUREMENT_ID', {'user_id': 'USER_ID'})) for web implementations. This setup is crucial for tracking user-specific data accurately.

  • Consistency: Verify that the method used to set the user_id is consistently applied across all platforms (web and mobile) to ensure uniformity in your data collection.

GTM Configuration

  • Variable Naming: In GTM, ensure that the Firebase User Property variable is named exactly as user_id, matching the identifier used in your app or website. Any discrepancies in naming could lead to the parameter not being captured correctly.

  • Default Value: Consider removing the default value for the user_id variable temporarily. This action can help determine if the issue lies with the data source itself by directly observing if the user_id is being set and passed through events.

Data Processing Delays

  • BigQuery Latency: Keep in mind that data might take up to 24 hours to appear in BigQuery. However, for immediate troubleshooting, leverage Firebase's DebugView, which provides real-time event tracking and can be invaluable for identifying issues with event parameters like user_id.

Debugging Tips

  • Developer Tools: Utilize your browser's developer tools to inspect network requests for events being sent. This can help confirm whether the user_id parameter is correctly included and passed with the correct value.

  • Firebase DebugView: Employ Firebase's DebugView for real-time insights into the events and parameters being sent. This tool is particularly useful for quickly identifying missing or incorrect parameters.

Additional Considerations

  • user_id Guidelines: While user_id is not reserved, it's a special parameter intended for identifying users across sessions and devices. Ensure that no personally identifiable information (PII) is attached directly to the user_id to comply with privacy regulations.

  • Custom Dimensions: For scenarios not requiring strict cross-device user identification, consider using a custom dimension (e.g., app_user_id). This approach can help avoid potential conflicts and is suitable for tracking additional user-level details without misusing the user_id field.

Example GTM Tag Configuration

To ensure clarity and effectiveness in your GTM setup, here's a simplified tag configuration guide:

  • Tag Type: Google Analytics: GA4 Configuration

  • Configuration: Select your Firebase/GA4 property

  • Event Modification: Under "Event Parameters," add:

    • Key Name: user_id

    • Value: Reference the GTM variable that captures the user ID, formatted as {{VariableName}}, ensuring it matches the setup in your Firebase or web application.

  • Triggering: Set to "All Events" or specify particular events as needed.

View solution in original post

1 REPLY 1

Hi @sysph ,

Yes, you can add user_id as a custom event parameter in Google Cloud Firebase through Google Tag Manager (GTM), and ideally, its value should not appear as "undefined" in BigQuery. Let's explore some refined troubleshooting steps to address this issue:

Troubleshooting Steps

User-ID Association

  • App Implementation: Ensure the user ID is correctly set in your app's code using the setUserId() method for mobile apps or through the user_id parameter in the Firebase config (gtag('config', 'GA_MEASUREMENT_ID', {'user_id': 'USER_ID'})) for web implementations. This setup is crucial for tracking user-specific data accurately.

  • Consistency: Verify that the method used to set the user_id is consistently applied across all platforms (web and mobile) to ensure uniformity in your data collection.

GTM Configuration

  • Variable Naming: In GTM, ensure that the Firebase User Property variable is named exactly as user_id, matching the identifier used in your app or website. Any discrepancies in naming could lead to the parameter not being captured correctly.

  • Default Value: Consider removing the default value for the user_id variable temporarily. This action can help determine if the issue lies with the data source itself by directly observing if the user_id is being set and passed through events.

Data Processing Delays

  • BigQuery Latency: Keep in mind that data might take up to 24 hours to appear in BigQuery. However, for immediate troubleshooting, leverage Firebase's DebugView, which provides real-time event tracking and can be invaluable for identifying issues with event parameters like user_id.

Debugging Tips

  • Developer Tools: Utilize your browser's developer tools to inspect network requests for events being sent. This can help confirm whether the user_id parameter is correctly included and passed with the correct value.

  • Firebase DebugView: Employ Firebase's DebugView for real-time insights into the events and parameters being sent. This tool is particularly useful for quickly identifying missing or incorrect parameters.

Additional Considerations

  • user_id Guidelines: While user_id is not reserved, it's a special parameter intended for identifying users across sessions and devices. Ensure that no personally identifiable information (PII) is attached directly to the user_id to comply with privacy regulations.

  • Custom Dimensions: For scenarios not requiring strict cross-device user identification, consider using a custom dimension (e.g., app_user_id). This approach can help avoid potential conflicts and is suitable for tracking additional user-level details without misusing the user_id field.

Example GTM Tag Configuration

To ensure clarity and effectiveness in your GTM setup, here's a simplified tag configuration guide:

  • Tag Type: Google Analytics: GA4 Configuration

  • Configuration: Select your Firebase/GA4 property

  • Event Modification: Under "Event Parameters," add:

    • Key Name: user_id

    • Value: Reference the GTM variable that captures the user ID, formatted as {{VariableName}}, ensuring it matches the setup in your Firebase or web application.

  • Triggering: Set to "All Events" or specify particular events as needed.