[DigitalPoint] Better Google Analytics

[DigitalPoint] Better Google Analytics 1.0.10

No permission to download
Maybe a small request for the client error log. An option to clear the log?
That's not really how Google Analytics works. It's not designed so you can go into it and arbitrarily delete analytics events. That applies to all types of events, like you couldn't just delete all page_views or sign_ups, just like you can't delete exceptions. The purpose of Google Analytics is analytics (see how things change over time).

That being said, Google Analytics gives you a lot of reporting tools if you want to use them. Like you can filter out any event type from reports as an example.

But to answer the original quetion (again), Google Analytics does not have a function to delete events other than the global deletion of all data before a certain date.
 
Works now. Must have needed a moment. :)
Not that it really matters to you at this point since it's working, I changed the error presented to the user for the next version. Rather than just pass through the error Google gives, it tells you what the issue is in more plain terms, doesn't log it to XenForo's server error log, and also gives you a link to make the necessary association. Hopefully I won't have to answer that question anymore. :)
 
Are these all things that'll show up as events on the GA site now that I've installed it?

View attachment 269845

And if I track user groups (like I selected) - where do I see that info? On GA site?

I'm presuming it'll take a while for this information to be gathered.
Is having Registered under user groups to track redundant? It seems that it is looking at my logs.
 
Is having Registered under user groups to track redundant? It seems that it is looking at my logs.
Ya probably not necessary unless you are doing something non-standard with XenForo. There's already an option to track "Registered members", and that tracks more granularly by the member's user_id. That allows you to do things like filter reports to only include events from a specific user (see the second screenshot from the last update to see how that works). Google Analytics already allows you to break down if a user is signed in with a user ID. For example:

1655742618374.png

The "Registered" user group inside XenForo is usually applied to all registered users, so yes... to answer your question, tracking the XenForo Registered user group would be redundant because Google Analytics already lets you break down by if the user has any user_id (which means they would be part of XenForo's Registered user group).

My personal use case for the user group tracking function is for paid user upgrades (in a priority order of most expensive to leave expensive).

1655742785921.png
 
Last edited:
tracking the XenForo Registered user group would be redundant because Google Analytics already lets you break down by if the user has any user_id (which means they would be part of XenForo's Registered user group).
How do I do that? I'm only seeing the option to select individual UID?
 
Was going to wait to see if any other feature requests popped up before putting out a new version so quick, but I'm also going on vacation tomorrow for 2 weeks, so whatever... here it is now. :)
 
Seems not to work with Xenforo 2.1.x, not tried older releases.
But when I press the LINK GOOGLE ACCOUNT button I get this:

Error: Class 'XF\Admin\ControllerPlugin\AbstractPlugin' not found in src/addons/DigitalPoint/Analytics/Admin/ControllerPlugin/AnalyticsOAuth.php at line 7
  1. include() in src/vendor/composer/ClassLoader.php at line 444
  2. Composer\Autoload\includeFile() in src/vendor/composer/ClassLoader.php at line 322
  3. Composer\Autoload\ClassLoader->loadClass()
  4. spl_autoload_call() in src/XF/Mvc/Controller.php at line 648
  5. XF\Mvc\Controller->plugin() in src/addons/DigitalPoint/Analytics/XF/Admin/Controller/Option.php at line 12
  6. DigitalPoint\Analytics\XF\Admin\Controller\Option->actionGoogleAnalyticsOAuth() in src/XF/Mvc/Dispatcher.php at line 350
  7. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 257
  8. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 113
  9. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 55
  10. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2184
  11. XF\App->run() in src/XF.php at line 391
  12. XF::runApp() in admin.php at line 13
Looks like the path is wrong or class is missing.
 
Seems not to work with Xenforo 2.1.x, not tried older releases.
But when I press the LINK GOOGLE ACCOUNT button I get this:

Error: Class 'XF\Admin\ControllerPlugin\AbstractPlugin' not found in src/addons/DigitalPoint/Analytics/Admin/ControllerPlugin/AnalyticsOAuth.php at line 7
  1. include() in src/vendor/composer/ClassLoader.php at line 444
  2. Composer\Autoload\includeFile() in src/vendor/composer/ClassLoader.php at line 322
  3. Composer\Autoload\ClassLoader->loadClass()
  4. spl_autoload_call() in src/XF/Mvc/Controller.php at line 648
  5. XF\Mvc\Controller->plugin() in src/addons/DigitalPoint/Analytics/XF/Admin/Controller/Option.php at line 12
  6. DigitalPoint\Analytics\XF\Admin\Controller\Option->actionGoogleAnalyticsOAuth() in src/XF/Mvc/Dispatcher.php at line 350
  7. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 257
  8. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 113
  9. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 55
  10. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2184
  11. XF\App->run() in src/XF.php at line 391
  12. XF::runApp() in admin.php at line 13
Looks like the path is wrong or class is missing.
You sir are correct. It wasn't until you just posted this that I realized that the Admin/ControllerPlugin classes didn't make an appearance until 2.2.0.

Going to update the plug-in info page to reflect that. Sorry about that. :(
 
If you want a workaround that doesn't actually involve upgrading to XenForo 2.2.x...

Workaround option #1: Download a copy of XenForo 2.2.x from the customer area and copy just the XF\Admin\ControllerPlugin\AbstractPlugin.php into an older install (probably as far back as 2.0.0) and it should work.

Workaround option #2: Open up the DigitalPoint\Analytics\Admin\ControllerPlugin\AnalyticsOAuth.php file, and change this:

PHP:
use XF\Admin\ControllerPlugin\AbstractPlugin;

to this:

PHP:
use XF\ControllerPlugin\AbstractPlugin;

...yes, it really would just be removing the "Admin" from that line.

Workaround option #3: 1.0.4.2 should work with 2.0 and 2.1 properly.
 
Last edited:
We utilize Cloudflare Zaraz to inject GA4, do you know if your plugin is compatible with it?
It is not. Zaraz is custom system that relays events to Cloudflare via their backend. The only events you can use are the ones Zaraz has defined, and they have very few events they understand. See their developer reference here: https://developers.cloudflare.com/zaraz/web-api/

Coincidentally, this add-on started as a Zaraz add-on, but there were just too many limitations (GA4 events you couldn't use), too many bugs, and you are really flying blind (you send events to Zaraz and have no clue how [or even if] it's translating that on their backend). The main thing I wanted Zaraz for was so I could call the analytics JavaScript from my own domain vs. from googletagmanager.com.

There were just too many problems and limitations with Zaraz for my liking, so I turned this add-on into a specific Google Analytics add-on. And the Host Google Tag Manager JavaScript on your own domain setting I made for this add-on solved the thing that made me want to use Zaraz.

From Cloudflare's developer Discord in the #zaraz channel...
1655853210400.png

Notice the date on that was a few weeks before this add-on was released. That was basically when I decided I was tired of fighting with Zaraz's limitations and I'd be better off doing what I want directly. :)

But to answer your question, no... Zaraz is it's own thing and you can't send Google Analytics events (directly) to Zaraz. Rather you have to send Zaraz events (which there aren't many of) and it will translate them into Google Analytics for you. Zaraz is pretty good at a really vanilla Google Analytics replacement (like if you just wanted to track page views). For anything more advanced, it's not that great.
 
Does the connection to the google account only works for real URLs or can it be tested with a local XAMPP installation.
Must be the board be available under https, or is http also working?

I get all the time:
  • ErrorException: [E_WARNING] curl_setopt_array(): Unable to create temporary file.
    src\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:56
 
No idea what XAMPP is, but if it makes your board not have a real URL, I suspect it’s not going to work.

As far as the curl error goes, that’s not from this addon (at least not directly). Guzzle does need to work for http requests (same with other things in XenForo).
 
Thanks so much for this - just one little request and that's an option to disable tracking for certain usergroups.

In my case, I don't want my own account being tracked as it's going to skew results, so if I could disable for the administrator group that would be great.

(I know I could just edit the template, but that's not so clean!)
 
Wouldn’t be that hard I suppose, but do you really want it for all admins or is it for just you personally and you happen to be the only admin? Like if you had other admins, you would want them excluded?

Google Analytics has the ability to filter data out by almost anything already, so you could filter out data for just your user ID as an example.
 
Top Bottom