@digitalpoint this addon is putting in two requests for /misc/a.js which does not exist on our server and is not in your installation package, so we're getting two 400 Bad Request errors.
View attachment 98344
This error has started since the installation of the latest update - v2 of the addon.
In library/DigitalPointBetterAnalytics/Listener/LoadClassControllerPublic/Misc.php you have
PHP:
<?php
class DigitalPointBetterAnalytics_Listener_LoadClassControllerPublic_Misc
{
public static function loadClassListener($class, &$extend)
{
if (strpos(@$_SERVER['REQUEST_URI'], '/a.js'))
{
$extend[] = 'DigitalPointBetterAnalytics_ControllerPublic_Misc';
}
}
}
Is this the issue?
I see that there *is* a digitalpoint.com/misc/a.js
Edit: Also, with the addon installed, according to Google Analytics Real Time we have 5 active users on the site. With it deactivated, we have hundreds. The addon is definitely broken. I'm leaving it disabled for the moment.
The short answer is it's a server configuration issue... Same issue as here:
https://xenforo.com/community/threads/better-analytics.58746/page-13#post-897490
Basically your web server is intercepting HTTP requests with certain extensions and not passing the request through (which is why if you go to the URL, you get an error from the web server, not an error from XenForo... it's not passing through the request.
You can see the different error here: Raw web server error (not passing the request through to the application):
https://www.avforums.com/misc/a.js
The same URL but different extension:
https://www.avforums.com/misc/a.txt
Different looking error page (meaning the request is getting to the application).
Probably some caching mechanism on the server that is basing itself on file extensions in the HTTP request, rather than if a file actually exists.
I'd say it's a server misconfiguration there, but if you don't want to fix it, you probably could work around it by editing the PAGE_CONTAINER template modification for Better Analytics, and change this:
Code:
<script src="misc/a.js?_v={$xenOptions.jsVersion}">
to this:
Code:
<script src="misc/a?_v={$xenOptions.jsVersion}">
and in the DigitalPointBetterAnalytics_Listener_LoadClassControllerPublic_Misc class, change this:
PHP:
if (strpos(@$_SERVER['REQUEST_URI'], '/a.js'))
to this:
PHP:
if (substr(@$_SERVER['DOCUMENT_URI'], -2) == '/a')
That would probably work around it, but ultimately it's a web server (or maybe front-end proxy of some sort) config issue on your end where the web server is intercepting HTTP requests based on the file extension even if that file doesn't exist on your web server.
Getting this error now:
Code:
Server Error Log
Error Info
Zend_Exception: No entry is registered for key 'session' - library/XenForo/Application.php:1007
Generated By: Unknown Account, A moment ago
Stack Trace
#0 /home/nginx/domains/aspiescentral.com/public/library/WidgetFramework/Option.php(22): XenForo_Application::get('session')
#1 /home/nginx/domains/aspiescentral.com/public/library/WidgetFramework/Listener.php(131): WidgetFramework_Option::get('layoutEditorEna...')
#2 [internal function]: WidgetFramework_Listener::template_post_render('better_analytic...', '$(document).rea...', Array, Object(XenForo_Template_Public))
#3 /home/nginx/domains/aspiescentral.com/public/library/XenForo/CodeEvent.php(58): call_user_func_array(Array, Array)
#4 /home/nginx/domains/aspiescentral.com/public/library/XenForo/Template/Abstract.php(195): XenForo_CodeEvent::fire('template_post_r...', Array, 'better_analytic...')
#5 /home/nginx/domains/aspiescentral.com/public/library/XenForo/Template/Public.php(110): XenForo_Template_Abstract->render()
#6 /home/nginx/domains/aspiescentral.com/public/library/DigitalPointBetterAnalytics/ViewPublic/JavaScript.php(13): XenForo_Template_Public->render()
#7 /home/nginx/domains/aspiescentral.com/public/library/XenForo/ViewRenderer/Abstract.php(227): DigitalPointBetterAnalytics_ViewPublic_JavaScript->renderHtml()
#8 /home/nginx/domains/aspiescentral.com/public/library/XenForo/ViewRenderer/HtmlPublic.php(71): XenForo_ViewRenderer_Abstract->renderViewObject('DigitalPointBet...', 'Html', Array, 'better_analytic...')
#9 /home/nginx/domains/aspiescentral.com/public/library/XenForo/FrontController.php(586): XenForo_ViewRenderer_HtmlPublic->renderView('DigitalPointBet...', Array, 'better_analytic...', NULL)
#10 /home/nginx/domains/aspiescentral.com/public/library/XenForo/FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_View), Object(XenForo_ViewRenderer_HtmlPublic), Array)
#11 /home/nginx/domains/aspiescentral.com/public/index.php(13): XenForo_FrontController->run()
#12 {main}
Request State
array(3) {
["url"] => string(51) "https://www.aspiescentral.com/misc/a.js?_v=c15df8d1"
["_GET"] => array(2) {
["/misc/a_js"] => string(0) ""
["_v"] => string(8) "c15df8d1"
}
["_POST"] => array(0) {
}
}
Looks like the WidgetFramework is assuming a user session is going to be available 100% of the time, which isn't always the case. They should be using the isRegistered function in XenForo before trying to get the session.
Something more like:
PHP:
if (XenForo_Application::isRegistered('session')) {
XenForo_Application::get('session'); // existing code
}
The session isn't guaranteed to be available (which is why there is a XF method to check if it's registered/available), they just don't seem to be using it.