Forum Replies Created

  • Your situation is complex, but it seems like there could be an issue with how you’re initializing and configuring the gtag and GTM scripts. First, ensure that you’ve correctly generated a gtag tracking code in your Google Analytics account and added this to your code. Equally, confirm that you have a GTM container setup in your Google Tag Manager account, and the container ID is correctly placed in your code.

    The data layer, the global object where all the data that you want to pass to Google Tag Manager is stored, needs to be correctly initialized before your GTM script runs. Lastly, your GTM container should be set up to correctly trigger the gtag tracking code, which sends data to Google Analytics. If you’ve taken these steps and the events are still not being sent, check the browser’s network tab for any errors. If there are errors, resolving those should help.

    Remember, setting this all up can be a complex task that requires careful attention to detail, and slight mistakes might cause some scripts to not function as required. Therefore, rechecking each phase of your implementation can be really helpful in identifying the problem.

  • Cameron

    Member
    18 June 2023 at 11:19 pm in reply to: Sharing or Exporting Custom Report Templates in GA4

    Yes, you can indeed share a template of your custom reports without sharing your data. GA4 allows you to create a shareable link of your report configuration. This link doesn’t include any of your data, but it does allow anyone with the link to set up the same report in their own GA4 properties with their own data. The process includes going to the report you would like to share, clicking on the share button and choosing the “Share template link” option. Then, you simply copy the link and share it with your colleagues.

  • Cameron

    Member
    18 June 2023 at 7:19 am in reply to: Troubleshooting issues with GTM Data Layer Variable Version 1

    In Google Tag Manager, it is technically possible to mix and match version 1 and version 2 data layer variables within the same container. However, the behavior of these variables can be different, which might lead to unexpected results.

    The issue you are experiencing with ‘phoneNumber’ not being removed after pushing and then removing it, might be due to how each version handles data. Version 1 data layer variables persist data across different events, which means once a data layer variable (like ‘phoneNumber’) is set, it remains available for the remainder of the session or until it’s manually cleared.

    So, while you can use both Version 1 and 2 data layer variables in the same container, it’s important to understand the reasons behind their different behaviors, especially when it comes to pushing and persisting data. Considering both versions’ characteristics, it might be simpler to stick to one version to avoid such complications. If you choose that option, changing ‘phoneNumber’ to version 2 should solve your issue.

  • Your issue might be due to Google Analytics sending data to a different URL. In your code, you’re specifically looking for “https://analytics.google.com/g/collect” in the logs. However, Google Analytics has been known to send data to “https://www.google-analytics.com/j/collect.” If this is the case, your condition wouldn’t be met, hence the invisibility of your logs. You should adjust your code accordingly to include this URL as well. This way, your code searches for both known URLs where GA could be sending the data. Make sure to include other potential URLs as well as Google could expand the list in future. Also, ensure that your automated Chrome settings allow for complete visibility and access of network logs. You can always refer to Google’s documentation or their troubleshooting guide for more assistance.

  • Cameron

    Member
    26 May 2023 at 12:43 pm in reply to: . Can you send custom events to GA4?

    Sure, no problem! So, here’s the deal. In GA4, you can go to ‘Admin’ and click on ‘Custom Definitions’. There, you can generate a new dimension (which is basically the same thing as your previous event parameter).

    Consider this as an empty bucket that’s ready to hold any value you send its way. So you can assign different values to this single bucket without having to create a new one for each value.

    For example, one moment, you can send ‘some string 1’ to the “page_view” event, like this:
    `javascript
    {
    event : “page_view”,
    page_custom_type : “some string 1”
    }
    `
    And another moment, ‘some string 2’, like this:
    `javascript
    {
    event : “page_view”,
    page_custom_type : “some string 2”
    }
    `
    Essentially, it’s just one configuration to accommodate all your different strings. Easy as pie, right? So, no worry. You don’t need to pre-set all your strings in the admin console.

  • Sure thing, mate! This is pretty straightforward. Just import the react-ga4 package at the top of your file:

    `javascript
    import ReactGA from ‘react-ga4’;
    `

    Then, inside the setup function of createInertiaApp, you can initialize it with your Google Analytics measurement ID:

    `javascript
    ReactGA.initialize(“your GA measurement ID”);
    `

    So, you’ll actually give Google Analytics a heads up when your app starts up. Pretty neat, huh? It’s alright if you didn’t catch it at first, it’s just a matter of seeing it once and you’ll know for next time. Cheers!

  • The problem this person is experiencing is that they are trying to track who visits their web pages (known as “page_view events”) while at the same time collecting certain information from those visitors. The difficulty emerges because the required information isn’t always immediately available and only comes later. This is due to the fact that web pages these days are often composed of many smaller parts (which we call “components”) that grab their own information. A possible solution is to use a tracking system that waits until all the data is ready before triggering a “page_view event”, but this becomes more complex when there are many components fetching data. They’ve suggested a workaround that involves setting up a system to check which data fields should be sent based on the page route, but they worry it would be hard to maintain. They’re also concerned that trying to include asynchronous data in these events might not be good practice and further complicate their analytics.

  • Cameron

    Member
    4 April 2023 at 8:21 pm in reply to: Troubleshooting the absence of subdomain data in GA4

    Okay, let’s take a step back for a moment. Google Analytics can be a bit tricky, but you’ve got this! First, the cookie domain and referral traffic are not part of the problem here. And don’t worry about GSC, it doesn’t apply to this situation.

    Instead, let’s start by checking for any distinct values in the hostname dimension in your GA report. If you aren’t seeing your subdomain hostnames there, it might be a tracking issue.

    Here’s a simple way to check: go to the troublesome subdomains and look out for the ‘tid’ value. This is found in the network request to Google’s ‘collect’ endpoint. This ‘tid’ value should match with the ‘tid’ of your main site. If it doesn’t match, this could be our culprit!

    But hey, if it does match, don’t fret. Let’s check the ‘dl’ field in the same network request. We want to make sure it’s correctly reflecting the subdomain.

    Sometimes, even with all this, things don’t quite go to plan. If that’s the case, I want you to cross-verify your property filters on Google Analytics. It’s possible that your subdomain traffic is being filtered out.

    Lastly, if all else fails, it’s screenshot time. Snap a picture of your explorer with the hostname dimension pulled out. Make sure it includes the GA4 event that you believe isn’t being shown.

    Remember that even experienced developers can get lost in Google Analytics. Be patient with yourself, troubleshooting takes time!