Forum Replies Created

  • When you add more dimensions to your request like “transactionId”, you’re drilling down further into the data. This might display more sessions that involve specific actions like transactions. As for the “(other)” row, Google uses that for a variety of data that doesn’t neatly fit into the other categories, which is why excluding it brings you closer to your original count.

  • Owen

    Member
    23 May 2023 at 7:38 pm in reply to: The GA4 Entrances metric in the Reporting API

    It doesn’t seem like Google’s reporting API provides a specific way to gather entrance info directly. The data might still be obtained indirectly by focusing on the first event of a session, but it appears there isn’t a straightforward method to extract these entrance metrics via the API.

  • Owen

    Member
    18 May 2023 at 3:29 am in reply to: Comparing GA4 and UA: Significant Increase in Direct Traffic

    No worries, buddy! The strange traffic shift you’re seeing is actually a little hiccup with GA4. You see, paid search events are wrongly ending up counted as organic or direct traffic – it’s a bug. You can track this issue online. Here you go: [Google Issue Tracker](https://issuetracker.google.com/issues/241258655).

  • In a React application, you normally initialize Google Tag Manager (GTM) in the main application component’s lifecycle method, making it available throughout your application. However, since your requirement is to disable or remove GTM scripts after a specific user action (like logging in), you’ll need a conditional approach.

    Unfortunately, the react-gtm-module doesn’t explicitly support unloading/removing GTM once initialized but there’s a way around. You can take advantage of the dynamic nature of javascript and React’s lifecycle methods to load/unload GTM based on the user’s authentication state.

    You’ll initialize the GTM in a specific component (or page) where you need it to track whatever information required. Once the user logins, you can change the state of the component triggering a re-render and making sure it does not initialize GTM again.

    Remember not to initialize GTM in the root component of your React app. Instead, initialize it at the page level components where you want the tag manager to track information. Initialize it in the componentDidMount or useEffect hook (if using functional components) based on some state (like user not logged in).

    As a reminder, this approach means you must handle the initialization and potential un-initialization of GTM on every specific page level component where tracking is required. Since the GTM script is loaded asynchronously, unloading it might not be instant and there may be some lag time, during which user activities might still be tracked.

    For that perfect solution removal of GTM would be a much more complex task because GTM, once loaded, creates various data layers and variables which are not easy to remove completely from the application runtime.

    In case, you want to prevent any tracking after the user logs in, you can use a different approach to prevent any GTM tags from firing after login, using the GTM admin console. You can set a unique cookie at user login, and in the GTM console, create a trigger that fires on all pages where the cookie is not set. This way, once a user logs in, the cookie is set and the trigger stops firing, effectively disabling tracking. This approach also has the advantage of simplicity and will help you manage all tracking behavior directly from the GTM console, without touching the code.

  • To rectify the mislabeling in Google Analytics 4 (GA4), you need to refine the UTM parameters associated with your campaigns. The “source_platform” UTM seems to be employed to distinguish between Google and non-Google sources. However, if Google Display campaigns are showing up in your non-Google data, it seems like there might be a flaw with your current tracking system.

    I’d recommend you reassess your tracking parameters and make sure the “source_platform” for Google campaigns is appropriately labeled as “Google” and not “Manual”. If the issue persists, then you could configure a new parameter specifically for Google Display campaigns, such as “campaign_type”, where you could specifically label each campaign type (e.g., Google Display, Google Search, Facebook, etc.).

    Keep in mind that any changes made to tracking parameters needs to be consistent and applied across all your campaigns. This is important to prevent future confusion or mislabeling. Also, remember to communicate these changes with your team to ensure that everyone is on the same page when it comes to campaign tracking. Finally, you might want to consider using an automated system to streamline and avoid human errors in campaign tracking in the future.

  • Owen

    Member
    28 February 2023 at 10:43 pm in reply to: How to include website domain in GA4 Google Analytics?

    You’re on the right track. It seems like you already have the “host” as a parameter in your function, but you’re not using it in the properties that you’re setting for the gtag pageview event. To track the hostname, you can simply append the hostname to the “page_path” and “page_location” properties.

    For “page_location”, ideally, it should contain the complete URL such that it includes the protocol (http or https), hostname and path.

    For “page_path”, it encompasses the page’s path and other information that comes after the domain name in the URL, you can add the hostname too for your reference.

    Here’s how to do it:

    `javascript
    function pageViewGa(pagePath, pageUrl, host) {
    gtag(“event”, “page_view”, {
    “page_title”: pagePath,
    “page_location”: host + pageUrl,
    “page_path”: host + pagePath
    });
    }
    `
    Just replace “pageUrl” and “pagePath” with your “host + pageUrl” and “host + pagePath” respectively, this will contain your hostname.
    Remember to make sure that “host” contains the correct value. If it doesn’t, you can get it from “window.location.hostname” in JavaScript.

  • Owen

    Member
    9 December 2022 at 11:39 am in reply to: Understanding Engagement Parameters in Google Analytics 4

    You’ve hit the nail on the head with your curiosity. In Google Analytics 4, the session_engaged parameter is mainly used to calculate engagement. It simply gives us a green signal when a session starts heating up, a clear way of showing that the user is involved.

    On the flip side, we have engaged_session_event. This adds a bit more context to the mix. It’s not just about knowing if a session is engaged, but also counting the number of engaged sessions the user is involved in. Interesting, huh?

    Now, while exploring the raw data, you’ve noticed that your conversion events sent by the Measurement Protocol don’t have the “session_engaged” event parameter, but they do flaunt that engaged_session_event tag. I know it’s not exactly what you expected, but hold on.

    I have a hunch, and take it with a grain of salt, that this tag might be triggered inside GA4, but isn’t exported in the raw data. That’s probably the reason why your hunt hasn’t been fruitful. You certainly are on to something there. However, when I tinker around with the engagement configurations, the only change I see is in the count of engaged sessions. Nothing else moves an inch.

    But, don’t you worry. This doesn’t make your sessions any less engaging. It’s all a part of the GA4 mystery, don’t you think?

  • Owen

    Member
    4 October 2022 at 2:42 pm in reply to: Unreported Users: GA4 Event Discrepancy

    In Google Analytics 4 (GA4), the user data might not be showing up even when you send a purchase event via Measurement Protocol using user_id as client_id due to a few reasons. One possible issue could be mismatched data or formatting issues. It’s important to ensure both user_id and client_id are sent correctly and in the right format, as GA4 has specific requirements for each identifier. Also, make sure that the user_id used is the one recognized by GA4. Moreover, there could be a delay in data processing in GA4, so the data might not show up immediately. If your Measurement Protocol requests are not correctly structured or some required fields are missing, this could also prevent the user data from appearing. Lastly, check your setup in GA4 and your data filters, as wrongly configured filters might exclude the incoming data.