[DigitalPoint] Better Google Analytics

[DigitalPoint] Better Google Analytics 1.1.1

No permission to download
It didn't work for me for some reason. Once I try to connect/disconnect from my user I get this error:


Code:
ErrorException: Fatal Error: Declaration of EWR\Member\Pub\Controller\Login::actionLogin() must be compatible with DigitalPoint\Analytics\XF\Pub\Controller\Login::actionLogin(XF\Mvc\ParameterBag $params) src/addons/EWR/Member/Pub/Controller/Login.php:9
Generated by: Username 19/6/24 at 13:00

Stack trace
#0 [internal function]: XF::handleFatalError()
#1 {main}
Request state
array(4) {
  ["url"] => string(17) "/login/keep-alive"
  ["referrer"] => string(23) "https://domain.com/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
Delete
What version of XenForo are you using and what’s EWR?
 
currently my xenforo version is 2.2.16 patch 2, xenforo2.3I'm thinking of switching after the stable version is released and all my addons and themes are upgraded to version 2.3. What version should I download for this plugin of yours right now?
 
The error message I get

Sunucu hata günlüğü
  • InvalidArgumentException: Missing OAuth2 token.
  • src/addons/DigitalPoint/Analytics/GoogleApi/AbstractApi.php:43
  • Tarafından: blues
  • 20 Haz 2024 - 15:42

Yığın izleme​

#0 src/addons/DigitalPoint/Analytics/GoogleApi/AbstractApi.php(11): DigitalPoint\Analytics\GoogleApi\AbstractApi->getToken()
#1 src/addons/DigitalPoint/Analytics/GoogleApi/Admin.php(14): DigitalPoint\Analytics\GoogleApi\AbstractApi->makeApiCall('accountSummarie...', Array, 'get')
#2 src/addons/DigitalPoint/Analytics/Repository/Reporting.php(11): DigitalPoint\Analytics\GoogleApi\Admin->accountSummariesList()
#3 src/addons/DigitalPoint/Analytics/XF/Admin/Controller/Option.php(111): DigitalPoint\Analytics\Repository\Reporting->getAccountSummaries()
#4 src/XF/Mvc/Dispatcher.php(352): DigitalPoint\Analytics\XF\Admin\Controller\Option->actionGoogleAnalyticsSelect(Object(XF\Mvc\ParameterBag))
#5 src/XF/Mvc/Dispatcher.php(258): XF\Mvc\Dispatcher->dispatchClass('XF:Option', 'GoogleAnalytics...', Object(XF\Mvc\RouteMatch), Object(DigitalPoint\Analytics\XF\Admin\Controller\Option), NULL)
#6 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(DigitalPoint\Analytics\XF\Admin\Controller\Option), NULL)
#7 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(2485): XF\Mvc\Dispatcher->run()
#9 src/XF.php(524): XF\App->run()
#10 admin.php(13): XF::runApp('XF\\Admin\\App')
#11 {main}

Durum isteği​

array(4) {
["url"] => string(193) "/admin.php?options/google-analytics-select&_xfRequestUri=%2Fadmin.php%3Foptions%2Fgroups%2Fanalytics%2F&_xfWithData=1&_xfToken=************************************************************xfResponseType=json"
["referrer"] => string(65) "************************************************************************************"
["_GET"] => array(5) {
["options/google-analytics-select"] => string(0) ""
["_xfRequestUri"] => string(36) "/******.php?options/groups/analytics/"
["_xfWithData"] => string(1) "1"
["_xfToken"] => string(43) "*******************************************************"
["_xfResponseType"] => string(4) "json"
}
["_POST"] => array(0) {
}
}
 
Last edited:

Sunucu Durum Raporu​

Önerilen PHP versiyonuna sahipsiniz.
PHP versiyonu8.2.19

I guess it started working. After the error report I received 11 minutes ago, I have not received another error report.

If I get another bug report I'll let you know.

Thanks It's a nice addon
 
Last edited:
XF 2.3 RC4

The only add-on from @Jaxel I have is this:
Have you tried disabling that addon and see if you still get the error? It's not tagged as being compatible with 2.3.

From the error, it looks like the issue is that whatever your "EWR" addon is needs an update:

ErrorException: Fatal Error: Declaration of EWR\Member\Pub\Controller\Login::actionLogin() must be compatible...

There were changes in XenForo's actionLogin() method that require an update for 2.3.
 
It might be me but I'm confused by this phrasing:

1719671853393.webp

It's default set to No. So I've changed this to Yes, to track with GA. Or does the yes mean not to track?

Sorry. :D
 
Not seeing it on this end… however if something is mucking (preventing or delaying) XenForo’s normal core lazy loading mechanism, you may see something like that. XF.on() definitely is a valid function in 2.3, but it only is after XF’s core’s JS runs.

Maybe the other errors about being unable to lazy load JS gives a clue somehow?

A different issue is that it appears your server isn’t able to serve a local copy of the gtm JavaScript (maybe disable the option to serve it from your own domain for now?).
 
Not seeing it on this end… however if something is mucking (preventing or delaying) XenForo’s normal core lazy loading mechanism, you may see something like that. XF.on() definitely is a valid function in 2.3, but it only is after XF’s core’s JS runs.

Maybe the other errors about being unable to lazy load JS gives a clue somehow?

A different issue is that it appears your server isn’t able to serve a local copy of the gtm JavaScript (maybe disable the option to serve it from your own domain for now?).
I disabled all addons and turn on one by one.
Zero error and only when turn on this addon that generates the erorrs.
Tested several times to confirm. What do you suggest I can do to nail down the issue?

Screenshot 2024-07-06 at 6.23.17 PM.webp
 
That JavaScript could probably be wrapped in a window.addEventListener('DOMContentLoaded', {}); function to work around some of the core XenForo JavaScript being lazy loaded. In helper_js_analytics template, if you change this:

JavaScript:
XF.on(document,"xf:reinit",(a)=>{if(a&&typeof(a)==='object'&&Object.prototype.toString.call(a)==='[object Event]'){if(typeof(a.target.querySelectorAll)==='function'){a.target.querySelectorAll(".overlay[data-url]:not([ga])").forEach(b=>{ b.setAttribute('ga',1);gtag("event","page_view",{page_title:b.querySelector(".overlay-title").textContent,page_location:b.getAttribute("data-url")})})}}});

...to this:

JavaScript:
window.addEventListener('DOMContentLoaded',()=>{XF.on(document,"xf:reinit",(a)=>{if(a&&typeof(a)==='object'&&Object.prototype.toString.call(a)==='[object Event]'){if(typeof(a.target.querySelectorAll)==='function'){a.target.querySelectorAll(".overlay[data-url]:not([ga])").forEach(b=>{ b.setAttribute('ga',1);gtag("event","page_view",{page_title:b.querySelector(".overlay-title").textContent,page_location:b.getAttribute("data-url")})})}}})});

does it work for you?

Also, I'm about to get on a plane, so I'm about to be MIA for a bit... sorry.
 
That JavaScript could probably be wrapped in a window.addEventListener('DOMContentLoaded', {}); function to work around some of the core XenForo JavaScript being lazy loaded. In helper_js_analytics template, if you change this:

JavaScript:
XF.on(document,"xf:reinit",(a)=>{if(a&&typeof(a)==='object'&&Object.prototype.toString.call(a)==='[object Event]'){if(typeof(a.target.querySelectorAll)==='function'){a.target.querySelectorAll(".overlay[data-url]:not([ga])").forEach(b=>{ b.setAttribute('ga',1);gtag("event","page_view",{page_title:b.querySelector(".overlay-title").textContent,page_location:b.getAttribute("data-url")})})}}});

...to this:

JavaScript:
window.addEventListener('DOMContentLoaded',()=>{XF.on(document,"xf:reinit",(a)=>{if(a&&typeof(a)==='object'&&Object.prototype.toString.call(a)==='[object Event]'){if(typeof(a.target.querySelectorAll)==='function'){a.target.querySelectorAll(".overlay[data-url]:not([ga])").forEach(b=>{ b.setAttribute('ga',1);gtag("event","page_view",{page_title:b.querySelector(".overlay-title").textContent,page_location:b.getAttribute("data-url")})})}}})});

does it work for you?

Also, I'm about to get on a plane, so I'm about to be MIA for a bit... sorry.
YES It does work!
Thank you.
 
I found that this add-on seems to break the WYGWIG and I'm trying the patch that you made to the post to see if this fixes it for 2.3

Update: This fixed the issue.
 
After upgrading from XF 2.2.15 to 2.2.16PL2, getting this error:

  • ErrorException: [E_DEPRECATED] explode(): Passing null to parameter #2 ($string) of type string is deprecated
  • src/addons/DigitalPoint/Analytics/Pub/Controller/Beacon.php:29
#0 [internal function]: XF::handlePhpError(8192, '[E_DEPRECATED] ...', '/home/talkbass/...', 29)
#1 src/addons/DigitalPoint/Analytics/Pub/Controller/Beacon.php(29): explode('|', NULL, 2)
#2 src/XF/Mvc/Dispatcher.php(352): DigitalPoint\Analytics\Pub\Controller\Beacon->actionImage(Object(XF\Mvc\ParameterBag))
#3 src/XF/Mvc/Dispatcher.php(258): XF\Mvc\Dispatcher->dispatchClass('DigitalPoint\\An...', 'Image', Object(XF\Mvc\RouteMatch), Object(DigitalPoint\Analytics\Pub\Controller\Beacon), NULL)
#4 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(DigitalPoint\Analytics\Pub\Controller\Beacon), NULL)
#5 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#6 src/XF/App.php(2485): XF\Mvc\Dispatcher->run()
#7 src/XF.php(524): XF\App->run()
#8 index.php(20): XF::runApp('XF\\Pub\\App')
#9 {main}

Request state​

array(4) {
["url"] => string(217) "/b/image.gif?p=4isFKkQtlABI%2FyMHS8U0HXqcqj%2FJNd6D%2BrOkMACCUIr9KmaosgU2Id8xykwVSsqdVZg1XE%2FLV4VY8vyC7IJV%2FEx51ylDEQXPV1j%2Fy5aapxFOuYyOn705QLh1msjTOFQOTugKnY3JYb39fB9X1Od0DhQTsNa%2FeYa5jsQvgRxWJ0Fe7mTWoFNb8FgKbxmV"
["referrer"] => bool(false)
["_GET"] => array(1) {
["/404_html"] => string(0) ""
}
["_POST"] => array(0) {
}
}
 
Back
Top Bottom