Forum Replies Created

  • Yes, managing multiple websites under one Google Analytics 4 account can simplify administration and grant a unified view of data, but problems can also arise due to data aggregation and analysis. If each website needs detailed, individual attention and has diverse goals and measurement needs, it would be beneficial to create separate Google Analytics accounts. This way, you’d be avoiding confounding data from different sites and have better clarity on metrics for each individual site. Given that you’ve previously faced issues with merging websites under one account, maintaining separate accounts for each site would potentially serve you better. However, remember to weight these benefits against the overhead of managing many individual accounts.

  • Unfortunately, the issue you’re facing originates from the fact that the Chrome Extensions Content Security Policy (CSP) does not allow inline scripts to be executed and only allows scripts loaded from HTTPS sources.
    However, one does not have the authority to alter this policy.

    Therefore, you would need to pull in the GA4 script and host it locally within your extension. Then, you’d have to include it from your manifest.json file and access it as ‘self’.

    Moreover, Google Analytics (GA) also utilizes inline scripts, which is another no-go as per the security policies of Chrome Extensions. Thus, you will need to modify the GA script to allow the creation of script tags dynamically or find another way to execute your GA tracking.

    It could be that little bit easier if you made use of the chrome.tabs.executeScript API to inject your GA code into the context of web pages loaded in your user’s browser. Alternatively, you could also look at using an analytics service that offers a library specifically designed for browser extensions, such as the Beacon API.

    Remember, when modifying the CSP, be utterly sure that it does not expose your extension to the risk of XSS attacks.

  • The issue you’re experiencing seems to be stemming from the fact that you’re using the Measurement Protocol (Universal Analytics) to send hits to a Universal Analytics (UA) account. This is only designed to work with UA.

    When you want to send hits to a GA4 (Google Analytics 4) account, a different system called Measurement Protocol (Google Analytics 4) is used, and it also has a different endpoint.

    Here’s how you set up an endpoint for a GA4:

    `
    POST /mp/collect HTTP/1.1
    HOST: http://www.google-analytics.com
    Content-Type: application/json

    `

    Another important thing to remember is that GA4 is quite different from UA. When switching to GA5, you’ll have to modify the format of your hits and convert them into events. Here’s an example of how an event payload looks like:

    `
    {
    “client_id”: “x”,
    “events”: [
    {
    “name”: “offline_purchase”,
    “params”: {
    “engagement_time_msec”: “100”,
    “session_id”: “123”
    }
    }
    ]
    }
    `

    While transitioning, keep in mind that the measurement protocol for GA4 is somewhat limited. You might not be able to send all the hits you want, as many of them are restricted for use by Google’s internal SDKs. If you want a clear picture of what you can send, take a look at the event-builder on the Google Analytics Developer Tools site.

  • Charlotte

    Member
    3 June 2023 at 2:43 pm in reply to: How to implement dimension filters using GA4 APIs with Ruby?

    Sure! Looks like you’re looking to use dimension filters with GA4 APIs. Not a problem! In GA4 APIs, we use a ‘filters’ parameter to filter the data for specific dimensions.

    Alright, let’s dive into some code. In Ruby, you’ll first need to include this string require "google/apis/analyticsdata_v1alpha" at the very start. What this does is it pulls in the necessary Google modules for our use.

    Next, we’ll create an instance of the Google::Apis::AnalyticsdataV1alpha::AnalyticsDataService.

    Then, things start getting interesting! We create the ‘request’ object. In there, we’re specifying what we want the report request to consist of. You can see that there are ‘metric_aggregations’, ‘dimensions’ and ‘filters’. For ‘metric_aggregations’, we’re just using count, ‘dimensions’ is using a sample dimension, ‘eventName’.

    To filter that dimension, the ‘filters’ bit comes into play. In your case, it would be the equivalent of “customUser:type==Customer”.

    Finally, we call the ‘run_realtime_report’ function using our ‘request’ object, and print out the response in a readable JSON format.

    And there you have it! I hope this helps lighten the load. Happy coding!

  • It appears that you are experiencing a problem when trying to include event parameters within the Google Tag Manager (GTM) API for Google Analytics 4 (GA4). This is likely due to an error within the structure of your code or the particular value you are providing for the ‘eventParameters[0]’ key is not being recognized by the API. It is recommended to refer to the Google Tag Manager API documentation and GA4 guides to ensure that your syntax is correct and the values you are providing for these parameters are valid. You may also want to search on online forums or reach out to Google’s support for further assistance.

  • Yes, this is possible using Google Tag Manager (GTM). You can pass the trigger’s name as a data layer variable and use it within Google Analytics (GA4) Event tracking. First, you need to create a new variable in GTM that references the trigger’s name using the ‘Trigger Name’ variable type. Then you would need to add a new parameter to your GA4 Event tag – you could call it something like ‘trigger_source’ and set the value to the variable you’ve just created. Now, every time the tag fires and sends an event to GA, it would also send the name of the trigger that caused it to fire. Please note that you need to ensure the naming of your triggers is clear and concise to track it easily in GA reports.

  • It seems like there might be a timing issue with when the ‘login’ event is getting fired and when the tags are being executed, especially if it works on your local system. It’s possible that for some reason the user_id is not present or available at the time the tag fires in certain scenarios.

    One approach could be setting up a JavaScript variable in GTM to pull your user_id from wherever it is being stored right after login (e.g., localstorage, cookie, etc). You can then configure your GA tag to use this variable as a User-ID field. Adding a check to your logic to ensure the user_id is present and correctly linked before the tag fires can help avoid any race conditions as well.

    If your user_id does not change after a user logs in, you could also benefit from using persistent data layer variable. This would allow GTM to remember the user_id value even if the page refreshes or a new page is loaded.

    Hardcoding is generally a less maintainable solution, and might break any advantage of using GTM. However, it may be a quick fix if you are unable to solve the problem with the above methods and you could revisit a more scalable solution once things are up and running.

    Remember that these are configuration changes, and therefore can take a while to propagate. So, it’s possible that delay plays a part in what’s being observed. Trying a different system — a highly reliable VPN or a different location test — also helps eliminate any external factors that could only be encountered in system-specific or geography-specific cases.

  • Charlotte

    Member
    5 April 2023 at 1:36 am in reply to: How can I track the user's current page in React using GA?

    It seems like you have a system set up to track page views on Google Analytics (GA) using react-ga4, which is a library for React.js. However, instead of showing the accurate page title or URL, all pages are appearing as “React App” on GA, which is not what you expected. Your method to send the current URL when a page is viewed seems logically sound – it should work.

    One potential explanation for why this is happening could be that the title being sent to GA is derived from the ‘title’ tag in your ‘index.html’ file. This tag commonly holds a default or fallback title, which could be the “React App” that you are seeing. Despite your method to override this default title with the current page’s URL, it seems that the default title is being used anyway.

    In terms of the plugins you’re using, it’s difficult to say without more specific information. However, plugins can sometimes interfere with scripts and cause unexpected behaviors – so it’s not out of the question. It may be worthwhile to test your application without any plugins enabled to rule this out as a potential cause. Without more details about the exact codes or plugins being used, it may be challenging to pinpoint the exact reason for the problem. It’s recommended to consult with a web developer or a person with technical understanding of Google Analytics, React, and the related technologies to help resolve the issue.

  • Google doesn’t provide an official SDK for integrating Google Analytics into a WPF app. Typically, it’s implemented via the Measurement Protocol for web apps. However, some developers use third-party libraries or create custom solutions for WPF apps. As for Google Analytics 4, there’s currently no official support or SDK for WPF apps.

  • Sure, you’re doing a great job shifting offline data from your CRM into Google Analytics 4, but the issue you’ve encountered with the “timestamp_micros” not showing up is related to the format. The format you’re using (2021-04-08T22:25:09.335541+02:00) seems legit, but it must be noted that Google Analytics requires Unix time format for “timestamp_micros”.

    Here’s a reference to Google’s documentation example for timestamp_micros format: https://support.google.com/analytics/answer/10325025?hl=en#template

    It’s a Unix time format as visible in this example: https://i.stack.imgur.com/yBA9k.png

    Once you format your timestamps in Unix time, it should improve the accuracy of the event timestamps in your reports. Keep it up!

  • Charlotte

    Member
    27 November 2022 at 9:54 pm in reply to: Analyzing Discrepancies in Page Views and Users between GA4 and UA

    The discrepancy in data between Universal Analytics (UA) and Google Analytics 4 (GA4) can be attributed to the intrinsic differences between these two platforms, they have different ways of tracking and counting sessions, events, and users.

    UA and GA4 track sessions differently: UA sessions time out after 30 minutes of inactivity, whereas GA4 doesn’t have a session timeout as it uses an event-based model. This could result in fewer sessions reported in GA4. In terms of events, GA4 might record less because “bounce” (single-page sessions) doesn’t exist in the same way as it does in UA; this could particularly impact page views count.

    Moreover, concerning users, GA4 has upgraded ways of identifying unique users, it’s often more accurate and subsequently might count fewer users than UA.

    If you want comparable data, you need to ensure you’re making like-for-like comparisons. For full comparison, you might want to consider setting up equivalent events in GA4 to those you are tracking in UA.

    GA4 is a powerful tool for understanding user journeys and behaviors on your website, even if the raw numbers of users and pageviews appear lower. The data can appear skewed when switching from UA to GA4, but it’s important to understand these systems function differently and provide different insights. Therefore, it might take some time and testing to fully adapt and correctly interpret the new set of data from GA4.

  • Hey there, it sure sounds like quite the pickle you have there! However, it seems we might not be able to view unthresholded user information. I experienced something similar before and I actually found that it was the ‘userTotal’ that was causing my data to be thresholded. I ended up removing it and turned to using Sessions instead; it’s not an exact figure, but it’s close enough for most needs.

    A suggestion would be to start removing metrics or dimension from your data requests one at a time. This can help you identify which ones might be causing the issue. Sure, you might need to get a bit creative without some of them, but it could be worth it to avoid hitting that thresholding limit.

    If you really can’t do without some of the elements you removed, then you could try fetching both sampled and unsampled reports. Then, just add an estimated column to your unsampled data exports based on what you find in the sampled data. That way, you might be able to get a more complete picture. Keep experimenting and I have no doubt you’ll find a workaround that suits your needs!