[DigitalPoint] Better Google Analytics

[DigitalPoint] Better Google Analytics 1.1.2.3

No permission to download
Any chance you would be able to enable debug in your XF config.php file and try it? The message you are seeing is what XF gives to end users without showing the actual error. Normally it logs whatever is going on to the server error log, but if that’s not happening for some reason, the only thing I can think of would be to just view the error directly with debug mode.
 
Here is what I got:
Code:
Audit usage of navigator.userAgent, navigator.appVersion, and navigator.platform

A page or script is accessing at least one of navigator.userAgent, navigator.appVersion, and navigator.platform. Starting in Chrome 101, the amount of information available in the User Agent string will be reduced.
To fix this issue, replace the usage of navigator.userAgent, navigator.appVersion, and navigator.platform with feature detection, progressive enhancement, or migrate to navigator.userAgentData.
Note that for performance reasons, only the first access to one of the properties is shown.
1 source
preamble.min.js:1
Learn more: User-Agent String Reduction
 
That looks like a client-side error (JavaScript). preamble.min.js isn’t part of this add-on (it’s part of XenForo), but I also don’t see how that could cause the server-side error you are seeing. What version of XenForo are you using?
 
Ya, what you are seeing is a server-side error, not client-side, so the browser console isn't going to show anything. What I was talking about is enabling debug mode in your config.php file for XenForo and seeing if you can see the actual error (will show in the normal browser window, you don't need to look into the browser console for anything).

PHP:
$config['debug'] = true;
 
Actually, nix that... Been looking over the code to see what might have caused what you are seeing.

Is there a possibility that the admin session for your XenForo user somehow changed between the time you started the Link Google account button and when you were returned with the code=xxxxx URL? Basically the add-on stores a bit of info in your session, sends you to the link and then needs to retrieve that bit of info when you return (from your session).
 
Last edited:
Actually, nix that... Been looking over the code to see what might have caused what you are seeing.

Is there a possibility that the admin session for your XenForo user somehow changed between the time you started the Link Google account button and when you were returned with the code=xxxxx URL? Basically the add-on stores a bit of info in your session, sends you to the link and then needs to retrieve that bit of info when you return (from your session).
I guess its possible, I have tired it many times. I have also hit the set button a few times and that will cause an error in the log. How do you suggest I fix the issue?
 
Basically the OAuth2 flow looks like this:
  1. Store some info about the requested credentials in the admin session for the user.
  2. Redirect the user to the page to request permission via Google OAuth2.
  3. User allows access to Google Analytics.
  4. User gets redirected back to the admin area (that's the URL you saw that had the code=xxxxx in it.
  5. System retrieves the credential info stored in the admin session for the user in step #1.
  6. Exchange the one-time use code with an OAuth2 Access token.
The best I can tell, it's failing at step #5... retrieving the info that was supposed to be stored in step #1 from the user's admin session.

If the admin session for the user was somehow reset, reloading the URL with the code=xxxx in it won't help because the missing bit of info from the session is needed.

I'd maybe just try the Link Google account button again. If XenForo requires you to re-login when you are returned, that's going to be a sign that the user's admin session disappeared.

Also, not sure what would happen if you denied the permission request, but it definitely won't work if you deny the requested permission (it doesn't ask for the permission "just because", it asks because it's needed).
 
Went ahead and got this done for next version. The URI filtering of chart data is presented using XenForo's filter system, rather than a form row. This allow you to remove the filter with a click. See how the URI-specific option can be removed with the X here:

View attachment 269524
Another idea came to mind. For the icon on the top right of the live side is to implement a drop down arrow and drop down UI so I can choose to view stats for "this page" or "overall". Otherwise I have to go into stats, clear the filter, and view stats. For me I will mainly be wanting to just get into stats and not be analyzing any specific page.
 
Another another idea: The icon on the top right is for analytics of the "site". Put the same icon on the top right of the first post in a thread for thread stats?
 
Another idea came to mind. For the icon on the top right of the live side is to implement a drop down arrow and drop down UI so I can choose to view stats for "this page" or "overall". Otherwise I have to go into stats, clear the filter, and view stats. For me I will mainly be wanting to just get into stats and not be analyzing any specific page.
Well, I'm trying not to add too much payload to the staff bar and clutter it with anything that isn't necessary (the link that's there now is page specific, so you kind of need it if you want to have page-specific reporting). Adding thing to the staff bar that are really nothing more than static links to different parts of the admin area seems misplaced imo. I'd say that a specific addon that lets you create links to whatever you want (what's important to you isn't going to be what is important to someone else) would be better suited for something like that. It's also simple enough to make your own template modification to do it since all it would be is a static link that doesn't change from page to page.

Another another idea: The icon on the top right is for analytics of the "site". Put the same icon on the top right of the first post in a thread for thread stats?
It's been added for the next version. There isn't an additional button, rather the existing button in the staff bar changes to give you a thread specific chart rather than a URL specific one. Using the same filter system that is used for URI (you can click to remove that filter).

1655139109136.webp
 
View attachment 269570

Do we have to set this to make it work with GA4?
No, it's optional. It's only if you want to track user_groups in a custom dimension. But you do need to set it if you want to track by user group. Google Analytics only allows a single value per dimension, so it's a priority system (highest user group that the user is part of is the one that is tracked).
 
Well, I'm trying not to add too much payload to the staff bar and clutter it with anything that isn't necessary (the link that's there now is page specific, so you kind of need it if you want to have page-specific reporting). Adding thing to the staff bar that are really nothing more than static links to different parts of the admin area seems misplaced imo. I'd say that a specific addon that lets you create links to whatever you want (what's important to you isn't going to be what is important to someone else) would be better suited for something like that. It's also simple enough to make your own template modification to do it since all it would be is a static link that doesn't change from page to page.


It's been added for the next version. There isn't an additional button, rather the existing button in the staff bar changes to give you a thread specific chart rather than a URL specific one. Using the same filter system that is used for URI (you can click to remove that filter).

View attachment 269569
I ended up doing something similar for users. If you are looking at a member profile, the link in the staff bar will take you to a report that allows you to see analytics just for that user. For example you could see how many page views (or whatever else) that user is generating over time (with the same filtering system where you can click to remove the user filter):

1655141131453.webp
 
Seems to be a conflict with this addon:


With Analytics installed, there is no longer a top bar for reverting the logged in user. I have spoken to xencept but they are unable to fix it at that end, ie they don't know what is causing it although they have diagnosed as a conflict with the the Analytics addon.
 
Would be really hard to debug on this end because I don't have access to a site that uses that add-on (and I don't know anything about it). I'm not even sure what the "top bar" is in this case.
 
'm not even sure what the "top bar" is in this case.
Sorry it's the staffbar

With this addon there is an analytics icon that shows there. With the other odeon, once logged in as a user, there is a link in the staffbar to revert back to yourself as user.
 
If that add-on is more or less taking over the staffBar completely, it might be as simple as changing the execution order of the PAGE_CONTAINER template modification.

If you want to send me the template modification that add-on is doing for the PAGE_CONTAINER template, I could probably help sort it out just by seeing that (I'm just assuming that's how they are doing it).
 
Back
Top Bottom