Forum Replies Created

  • It seems like you’re noticing some weirdness with your token usage appearing low. Not entirely sure of the cause, but you could be onto something about changes happening behind the scenes. Interesting to see if others are finding similar things!

  • The discrepancy you are experiencing could be due to a number of reasons. One possibility is that GA4 is categorizing what should be ‘app’ and others as null on BigQuery. This issue could be arising because some referrers don’t pass the referrer information to your website and as a result, GA4 records the event as direct traffic or null referrer in BigQuery. Besides, GA4 and BigQuery handle bots and spam sessions differently and this could also result in discrepancies.

    Another important factor you need to consider is the timing of your data export from GA4 to BigQuery. If the data is exported in real-time, there could be some differences due to data latency. Therefore, it is recommended to compare data of GA4 and BigQuery for a past period, when both datasets are complete.

    If you are fetching the UTM parameter from the URL, you have to consider that the page_location variable captures the full URL of the page where the event is triggered. It is possible that not all your sessions start on a page where UTMs are present in the URL or maybe the UTMs are dropped in subsequent pages within the same session. Therefore, the actual number of sessions per campaign in GA4 can be different compared to what you get when you fetch the UTM from page_location in BigQuery.

    It’s also worth checking that the event parameters that you are using in your SQL query do indeed contain the referrer data you need. Use DebugView in Firebase to see the events and their parameters as they occur in your GA4 property, and make sure you’ve got your query parameters correct.

    Finally, remember that the way GA4 and BigQuery treat and record data is fundamentally different. GA4 preprocesses and aggregates data for you, while BigQuery provides the raw, event-level data. Discrepancies can arise simply because of these inherent differences. It’s always a good idea to thoroughly understand the data schema of both GA4 and BigQuery, and know exactly what each field contains and how to use it.

  • The issue you’re facing is common when the access token, which is designed to expire after an hour, needs to be refreshed. If you see an “invalid_grant” error, this is usually because the refresh token is either expired or was revoked.

    First, ensure that your system’s clock is synchronized with a network time server, as time discrepancies can cause such issues. If the error persists, then obtain a new set of credentials by re-authenticating your application. The refresh token is typically returned the first time your application is authorized, so you’d need to prompt for re-authentication.

    To ensure that your refresh token is valid for GA4, you may have to check with the application or system that generated it. The refresh token is specific to the client ID, client secret, and scopes that were included when the original access token was requested, and GA4 should technically be part of the scopes if it was included in your initial request.

    There’s no specific call to refresh a refresh token, but you’ll get a new one each time you perform the initial authorization. So, to obtain a new refresh token, you’ll need to run through the OAuth2.0 flow again. Understanding this will help you handle token-related errors proactively in the future.

    Lastly, remember that the refresh token can stop working for a number of reasons, including when the user revokes the token, the refresh token is not used for six months, or the user changed passwords.

  • Ava

    Member
    2 June 2023 at 4:57 pm in reply to: Troubleshooting issue with Google Analytics 4's set method

    The issue you’re encountering arises from how Google Analytics 4 handles parameters. When you use “set”, it configures certain default fields to be sent with all tracking hits. However, this doesn’t apply to event parameters as Google Analytics 4 may not persist these parameters across all events.

    In your first code block, you’re sending ‘foo’ as an event parameter which is correct and this is why it is working as intended.

    In your second code block, when you use “set” you’re trying to send a default field, but this won’t apply to an event unless explicitly defined. ‘foo’ is ignored because it’s not a predefined field that is recognized by GA4. If you wanted to set a global value to be sent with every event, you could use ‘user_properties’ in GA4 set-up. Essentially, the difference between the examples you shared is based on the scope of the parameters you’re trying to set/send with your events. This is why they’re not yielding the same result.

  • Ava

    Member
    15 May 2023 at 5:18 pm in reply to: Understanding Duplicate Path Tracking in Google Analytics (4)

    This situation may be taking place due to several reasons. One of them could be the way your website is set up. For instance, your site might have scripts causing it to track each page twice – once with the top domain, once without. It could also be related to a setting in your GA4 setup where it’s been told to track pages in two different ways. Another possible explanation is that some visitors get to your website by typing the domain, while others arrive via a link that includes the www prefix. This would generate different entries on GA4. The best way to solve this would be revisiting your GA4 configuration settings to remove any duplications and consistency in link sharing. Also, consider talking to a web developer who understands GA4 to help you identify and fix the issue.

  • Sure, analysing how often your “xyz” event occurs in relation to “page_view” events should be fairly straightforward with Google Analytics 4 or Google Data Studio. You’d want to calculate the ratio of “xyz” events to “page_view” events as a percentage. If you’re struggling with this, it could mean there’s a tracking issue or the numbers have not been set up to correlate correctly. Try double-checking your tracking settings and maybe seek some expert insight on setting up the metrics in Google Analytics 4 or Google Data Studio if the problem persists.