[DigitalPoint] Better Google Analytics

[DigitalPoint] Better Google Analytics 1.0.10

No permission to download
This is looking great and will give a 5* review!

I'm only seeing one event, ie page_view. Should I be able to others, e.g. user_engagement?
 
This is looking great and will give a 5* review!

I'm only seeing one event, ie page_view. Should I be able to others, e.g. user_engagement?
Ya, it depends on where you are looking and of course if other events have happened. For example I just see some standard events in the realtime view because it's a low traffic site and not much happens:

1653586404632.webp

If I look for yesterday rather than realtime/now, it looks more like this:

1653586470094.webp

So ya... just comes down to where exactly you are looking. Also, if it's a brand new property (like you just created the GA4 property), it can take 48 hours before stuff starts looking normal.
 
@digitalpoint, first let me say thanks for sharing your work on this. A know there are quite a few of us that have put off using/switching to GA4 due to the learning curve. This will help a lot of people I'm sure.

Just one observation/question... When this add-on is enabled I see Universal Analytics gets completely disabled (no active stats showing or logging, if previously setup). Could you make an option to allow Universal Analytics to still process data until the admin is ready to fully switch over to using the GA4 property only.
 
@digitalpoint, first let me say thanks for sharing your work on this. A know there are quite a few of us that have put off using/switching to GA4 due to the learning curve. This will help a lot of people I'm sure.

Just one observation/question... When this add-on is enabled I see Universal Analytics gets completely disabled (no active stats showing or logging, if previously setup). Could you make an option to allow Universal Analytics to still process data until the admin is ready to fully switch over to using the GA4 property only.
Universal Analytics has an option where you can sort of mirror the data coming from Universal Analytics to Google Analytics 4.

If you look under your GA4 property settings under Data streams -> More tagging settings -> Collect Universal Analytics events. I believe then you could just push data into GA4 from UA and then once you are ready to make the switch and you are happy with GA4, use this add-on at that point (the default XF setup supports either UA or GA4).

Beyond that, I'm honestly not terribly keen on trying to support UA with this add-on. UA is going away before too long... as in really going away (won't process data any longer). So spending time to try and support UA just seems like a bit of a waste to me. Also, wouldn't it be better to have a clean cutoff date where you go from UA to GA4 without overlap? Like let's say you had a 2 month overlap and you wanted to build some report that pulls data from both UA and GA4. How do you handle where there's a 2 month period where the combined data is wrong because you were processing both UA and GA4? Doesn't seem to me like there's much use in processing both concurrently (maybe I just don't understand the use case there, which is definitely possible).
 
Doesn't seem to me like there's much use in processing both concurrently (maybe I just don't understand the use case there, which is definitely possible).
It's just currently this add-on when enabled disables the default XenForo support for Universal Analytics. Not looking for this add-on to support UA, just looking for it to work along side XenForo's built in support for UA.

Many admins will have custom analytics goals, events, dashboards, etc. already created in Universal Analytics that won't be supported by this add-on out of the box. Admins will still have to manually re-created these in GA4. Until these are all created in GA4 they will be depending on UA to still work. currently it does not when this add-on is enabled.

I have UA and GA4 both currently running and processing XenForo site data and am slowing getting all my customizations moved over to GA4. Your add-on will help with a lot of that, but as soon as I enable it I lose everything on the UA side - no more stats incoming there.
 
Ya, understood. But like I said, Google Analytics 4 has a built in feature that basically does exactly what you are trying to do already. In your data stream in GA4, there's an option under Additional Settings where you can connect a non-GA4 property under Manage connected site tags.

1653599838247.webp

Some info about dual tagging UA and GA4 here:



If you have custom events you are sending with UA that you are trying to retain, I assume you are using the gtag() function to do it (since XF's default setup is using Google's Tag Manager). Google Tag Manager can already be used across both UA and GA4 properties with the singular gtag() calls (I assume they did it this way so people could have their backend setup with custom UA events and it would inherently magically work with GA4 later). And as a byproduct, GA4 allows the dual tagging system with little friction.

So basically if you are using UA Google Analytics with Google Tag Manager (which is how XF does it), even with custom events, you should be able to simply keep using those custom events with GA4 and/or dual tag without any changes to those events or code on your site since you can tell Google Analytics which of your UA sites you want to connect the data to for dual tagging on the backend with singular gtag() calls.
 
Ya, understood. But like I said, Google Analytics 4 has a built in feature that basically does exactly what you are trying to do already.
You are correct and that is what I currently have setup during my transition - UA is currently passing everything through to GA4. The issue is as soon as this add-on is enabled UA stops getting data. Which I assume is because this add-on somehow overrides/disables the existing Google Analytics UA property ID setting built into XenForo which is still required for the UA to GA4 pass-through to work.

Add-on disabled: I see live data showing in both UA and GA4
Add-on enabled: Live data only showing in GA4 (with benefit of additional add-on features)

Maybe I'm the only one who will care that this happens. Thanks again for the add-on.
 
Have you done the thing in your GA4 data stream settings where you connect the UA site? I believe that in theory that's all you need to do to have all the incoming data from GA4 dual tag (send data to) your UA property. Without that, the backend of Google Analytics 4 isn't going to know which UA property you are wanting to relay everything into.
 
Have you done the thing in your GA4 data stream settings where you connect the UA site? I believe that in theory that's all you need to do to have all the incoming data from GA4 dual tag (send data to) your UA property. Without that, the backend of Google Analytics 4 isn't going to know which UA property you are wanting to relay everything into.
Yes, I have the pass through setup and working fine. I think the issue is that for the passthrough to work the data needs to come through UA and it is then passed to GA4 - is doesn't work the other way around (GA4 will not pass data to UA). This add-on I believe disables/by-passes the XenForo UA property ID setting all together so UA never gets the data to pass-through and the only data that is seen is what is processed through the GA4 account attached in the settings of this add-on.
 
So it wouldn’t be that hard to let someone override the measurement ID with their UA property ID.

But here’s the new problem that causes… it breaks all the API stuff. The APIs used between UA and GA4 are totally different. So some of the events this addon does would completely cease to function (like email sent/read as that’s done with API), all reporting would break, all setup/config of things like dimensions would break as well. Probably not worth it considering all that.
 
It's just currently this add-on when enabled disables the default XenForo support for Universal Analytics. Not looking for this add-on to support UA, just looking for it to work along side XenForo's built in support for UA.

Many admins will have custom analytics goals, events, dashboards, etc. already created in Universal Analytics that won't be supported by this add-on out of the box. Admins will still have to manually re-created these in GA4. Until these are all created in GA4 they will be depending on UA to still work. currently it does not when this add-on is enabled.

I have UA and GA4 both currently running and processing XenForo site data and am slowing getting all my customizations moved over to GA4. Your add-on will help with a lot of that, but as soon as I enable it I lose everything on the UA side - no more stats incoming there.

It shouldn't disable anything.

I have both UA and ga4 running side by side. When I created my ga4 property I used the wizard which connects UA to GA4. I left my xf UA setting untouched and simply connected this addon to the ga4 account. I see stats in both over at Google mothership. Not sure if that's the proper way but seems to work so far.
 
It shouldn't disable anything.

I have both UA and ga4 running side by side. When I created my ga4 property I used the wizard which connects UA to GA4. I left my xf UA setting untouched and simply connected this addon to the ga4 account. I see stats in both over at Google mothership. Not sure if that's the proper way but seems to work so far.

Interesting, any chance you have your UA property ID stored somewhere else in a template or another add-on that Google is still seeing. Because this add-on definitely overrides XenForo's default

With this add-on not installed/disabled the code on page looks like:
PHP:
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-X"></script>
    <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        gtag('config', 'UA-XXXXXXXX-X', {
            //
            'anonymize_ip': true,   
        });
    </script>

With this add-on enabled the code on page looks like:
PHP:
<script async src="/community/javascript/gtm.js?_v=9324c873"></script>
    <script>
        window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}gtag("js",new Date);gtag('config','G-XXXXXXXXXX',{'user_id':'1','style_id':1,'user_properties': {
        'uid':1,
        },});
!function(b,c){"object"==typeof console&&"function"==typeof console.error&&(console.error_old=console.error,console.error=function(){console.error_old.apply(this,arguments);b.gtag("event","exception",{error_type:"console",error_message:arguments[0],fatal:!1})});b.onerror=function(a,d,e){b.gtag("event","exception",{error_type:"javascript",error_message:a,error_location:d,error_line_number:e,fatal:!1})};b.onload=function(){c.querySelectorAll("img").forEach(a=>{a.complete&&0===a.naturalWidth&&b.gtag("event",
"exception",{error_type:"image",error_message:"not_loaded",error_location:a.src,fatal:!1})})}}(window,document);
    </script>
 
Does this add-on already send enough data to allow me to create filters and views based on whether a user is registered or unregistered?

At present t I have edited the stock google_analytics template to send over a custom dimension (which I can then use to filter in the reports too).
 
Installed on a test site and can see the Stats icon added twice to the staff bar

1653656468570.webp

Checked the template modifications which are below

1653656580754.webp

This is also a style from PixelExit called Bolt
 
Does this add-on already send enough data to allow me to create filters and views based on whether a user is registered or unregistered?

At present t I have edited the stock google_analytics template to send over a custom dimension (which I can then use to filter in the reports too).
Yes it does.

Installed on a test site and can see the Stats icon added twice to the staff bar

View attachment 268860

Checked the template modifications which are below

View attachment 268861

This is also a style from PixelExit called Bolt
If you want to send me the PAGE_CONTAINER template (privately via conversation), I should be able to sort it out with their style. But can’t do much without being able to see that template in that style.
 
Question about the passive items & events tracking.
For example the setting "Nodes - Allows you to see which nodes get the most usage."
Should this be visible in the Analytics charts (admin.php?analytics/charts) or within Google Analytics console? I can't find it.
 
Ya, it depends on where you are looking and of course if other events have happened. For example I just see some standard events in the realtime view because it's a low traffic site and not much happens:

View attachment 268824

If I look for yesterday rather than realtime/now, it looks more like this:

View attachment 268825

So ya... just comes down to where exactly you are looking. Also, if it's a brand new property (like you just created the GA4 property), it can take 48 hours before stuff starts looking normal.
Thanks. However it has now been well over 48 hours.

In ACP : Logs > charts I am still just seeing one event (page_view)

Screenshot 2022-05-29 at 11.24.13.png

However in Google Analyticsitself I see the other events:

Screenshot 2022-05-29 at 11.21.00.png

I apologise if this is a setting in Google I have missed (I just created the default GA4 property via the addon setting)
 
Last edited:
Question about the passive items & events tracking.
For example the setting "Nodes - Allows you to see which nodes get the most usage."
Should this be visible in the Analytics charts (admin.php?analytics/charts) or within Google Analytics console? I can't find it.
By default, node_id is one of 9 custom dimensions that the addon defines in your Google Analytics account. That allows you to make reports or comparisons within the Google Analytics interface. For example here, I added a comparison on the Engagement -> Events report in Google Analytics so it compares all events to events that include thread_id 5, 8 and 9 (just random thread IDs for this example).

1653839397002.png

Custom dimensions are really intended for just being available for comparison or if you want to create a custom report in Google Analytics, so it's however you want to view (or if you want to view) the dimensions. You can define more dimensions for reporting if you want (the add-on creates 9 by default, but there's a limit of 25 user scoped and 50 event scoped dimensions you can have per property). It doesn't create every possible dimension intentionally in case you have other dimensions you have. In your Google Analytics account, you can go to Configure -> Custom definitions, and there you can see your existing custom dimensions/metrics as well as an option to "Create custom dimensions" if you wanted to add additional ones. For example, maybe thread_author is one you find important enough to use one of your custom dimension slots for reporting:

1653839723130.png

While there is no limitation on custom parameters being sent to Google Analytics, you need to define your custom dimensions for what you actually want to report on.

Here's another example of how you could use it... in the Google Analytics Explore area, I made a report that shows me users that have viewed thread_id between 5 and 9. Not really for any useful purpose, just to illustrate that it's really up to you how you want to view data and for what purpose:

1653840377651.png


Thanks. However it has now been well over 48 hours.

In ACP : Logs > charts I am still just seeing one event (page_view)

View attachment 268926

However in Google Analyticsitself I see the other events:

View attachment 268924

I apologise if this is a setting in Google I have missed (I just created the default GA4 property via the addon setting)
Ya, I know about that already. Specifically, the chart metric is defaulting to "screenPageViews", which guess what, only applies to page_views... because that's what it is. :)

For the rest of the dimensions available on the chart, charting by the page view metric is probably more useful, which is why it's using that metric. But ya, my intention is to be able to internally override the metric based on the dimension for exactly that dimension on that chart. So instead of page views (which only the page_view event would apply to, the eventCount would be better suited for that particular dimension. But it's not well suited for the other dimensions (for example, it's probably more useful to know how many pages a user scrolled down rather than how many total times they scrolled [you could have someone scrolling 50 different times on a single page view]).

So ya, long story short is that I'm already aware of that issue with that particular dimension on that chart. At the time I realized it, I decided to sit on it a bit and think of the best way to address it without making the report overly complicated (like specifically picking a dimension and a metric for each chart would end up with a lot more confusion with people picking incompatible dimensions/metrics). I think I know a good way to resolve it now, I just need to code it. :)

Unrelated, but if you want to get more data (like outbound clicks, scrolling, site search, YouTube video engagement, etc), you will want to go into your Google Analytics settings, go to your property, then to your data stream settings and enable "Enhanced measurement".
 
Thanks,

think of the best way to address it without making the report overly complicated (like specifically picking a dimension and a metric for each chart would end up with a lot more confusion with people picking incompatible dimensions/metrics).

However in my case I just would like it really simple. All I actually want are page views and user engagement. Which I suspect is all a lot of people may want.
 
Top Bottom