[DigitalPoint] Better Google Analytics

[DigitalPoint] Better Google Analytics 1.1.1

No permission to download
  • TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given
  • src/addons/DigitalPoint/Analytics/Pub/Controller/Beacon.php:31
Careful with this error, I've disabled the addon for the following reasons:
  • registration emails started going to spam (thankfully a new registrant let me know)
  • on investigation, i found that "image.gif?p=" was being added to registrant emails (for tracking by this addon)
    • This <img src=image.gif> link was resulting in a 403 forbidden error
    • This 403 was increasing spam score (@Yahoo at the very least was then moving mails to spam)
    • The 403 was a resut of the error above that's been reported
Perhaps the above helps resolve.

Cheers
 
Careful with this error, I've disabled the addon for the following reasons:
  • registration emails started going to spam (thankfully a new registrant let me know)
  • on investigation, i found that "image.gif?p=" was being added to registrant emails (for tracking by this addon)
    • This <img src=image.gif> link was resulting in a 403 forbidden error
    • This 403 was increasing spam score (@Yahoo at the very least was then moving mails to spam)
    • The 403 was a resut of the error above that's been reported
Perhaps the above helps resolve.

Cheers
Thanks, addon disabled
 
Can also disable email tracking if you don't want it to track read emails (the image is only added to the email when you are trying to track read emails).
 
@digitalpoint any ideas why I am getting this error when I try to link to the GA4 property?
Code:
InvalidArgumentException: uid is a reserved parameter_name and cannot be used. in src/addons/DigitalPoint/Analytics/GoogleApi/AbstractApi.php at line 31
DigitalPoint\Analytics\GoogleApi\AbstractApi->makeApiCall() in src/addons/DigitalPoint/Analytics/GoogleApi/Admin.php at line 123
DigitalPoint\Analytics\GoogleApi\Admin->createCustomDimension() in src/addons/DigitalPoint/Analytics/Repository/Reporting.php at line 131
DigitalPoint\Analytics\Repository\Reporting->createCustomDimension() in src/addons/DigitalPoint/Analytics/Repository/Reporting.php at line 121
DigitalPoint\Analytics\Repository\Reporting->createNeededDimensions() in src/addons/DigitalPoint/Analytics/XF/Admin/Controller/Option.php at line 90
DigitalPoint\Analytics\XF\Admin\Controller\Option->actionGoogleAnalyticsSelect() in src/XF/Mvc/Dispatcher.php at line 352
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 258
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2485
XF\App->run() in src/XF.php at line 524
XF::runApp() in admin.php at line 13
1722292114109.webp
 
@digitalpoint any ideas why I am getting this error when I try to link to the GA4 property?
Code:
InvalidArgumentException: uid is a reserved parameter_name and cannot be used. in src/addons/DigitalPoint/Analytics/GoogleApi/AbstractApi.php at line 31
DigitalPoint\Analytics\GoogleApi\AbstractApi->makeApiCall() in src/addons/DigitalPoint/Analytics/GoogleApi/Admin.php at line 123
DigitalPoint\Analytics\GoogleApi\Admin->createCustomDimension() in src/addons/DigitalPoint/Analytics/Repository/Reporting.php at line 131
DigitalPoint\Analytics\Repository\Reporting->createCustomDimension() in src/addons/DigitalPoint/Analytics/Repository/Reporting.php at line 121
DigitalPoint\Analytics\Repository\Reporting->createNeededDimensions() in src/addons/DigitalPoint/Analytics/XF/Admin/Controller/Option.php at line 90
DigitalPoint\Analytics\XF\Admin\Controller\Option->actionGoogleAnalyticsSelect() in src/XF/Mvc/Dispatcher.php at line 352
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 258
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2485
XF\App->run() in src/XF.php at line 524
XF::runApp() in admin.php at line 13
View attachment 307506
same issue...

I'm also getting this error:

Oops! We ran into some problems.
InvalidArgumentException: uid is a reserved parameter_name and cannot be used. in src/addons/DigitalPoint/Analytics/GoogleApi/AbstractApi.php at line 31
  1. DigitalPoint\Analytics\GoogleApi\AbstractApi->makeApiCall() insrc/addons/DigitalPoint/Analytics/GoogleApi/Admin.php at line 123
  2. DigitalPoint\Analytics\GoogleApi\Admin->createCustomDimension() insrc/addons/DigitalPoint/Analytics/Repository/Reporting.php at line 131
  3. DigitalPoint\Analytics\Repository\Reporting->createCustomDimension() insrc/addons/DigitalPoint/Analytics/Repository/Reporting.php at line 121
  4. DigitalPoint\Analytics\Repository\Reporting->createNeededDimensions() insrc/addons/DigitalPoint/Analytics/XF/Admin/Controller/Option.php at line 90
  5. DigitalPoint\Analytics\XF\Admin\Controller\Option->actionGoogleAnalyticsSelect() insrc/XF/Mvc/Dispatcher.php at line 362
  6. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 264
  7. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 121
  8. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 63
  9. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2813
  10. XF\App->run() in src/XF.php at line 802
  11. XF::runApp() in admin.php at line 15

when trying to select property.
@digitalpoint can you please check.
 
any ideas why I am getting this error when I try to link to the GA4 property?

same issue...

I'm also getting this error:

 
digitalpoint updated [DigitalPoint] Better Google Analytics with a new update entry:

Minor update

  • Fixed issue when tracking emails being opened and the encrypted payload is invalid
  • Changed user property for tracking user ID from uid to usid
!!Important!!

It seems Google Analytics doesn't allow creation of the user property uid any longer so user ID tracked has been changed to usid. For new installations, nothing needs to change, but for existing installations, you'll...

Read the rest of this update entry...
 
For those that got the "uid is a reserved parameter_name" error, but otherwise things worked okay, you can also use the "Set" option to reselect your property/data stream and it will make sure the custom dimensions are defined properly.
 
I’ve been seeing later_at_time instead of actual times
According to this thread it’s caused by this addon


I’ve disabled it for now so I can monitor to see if it is the cause
 
Hasn't moved... it's in the Logs section under Analytics (same place as XenForo's default Statistics area).
Thanks and sorry for not clarifying it. I meant the dedicated Google website, similar to Google Webmaster where you login and see all the stats.
 
Whoops, sorry.

Database is utf8mb4 (converted from XF 1.5).
I’d still guess there’s somehow some invalid Unicode encoding somewhere. It might be worth checking your conversation table to see if any titles are invalid utf encoding somehow.

I can’t decode the string to tell you what it actually is (it’s encrypted and the encryption key is only in your site).
 
@digitalpoint I'm getting the following error on 2.3:
Code:
GuzzleHttp\Exception\InvalidArgumentException: json_encode error: Malformed UTF-8 characters, possibly incorrectly encoded src/vendor/guzzlehttp/guzzle/src/Utils.php:298
Generated by: Unknown account Aug 30, 2024 at 11:34 PM
Stack trace
#0 src/vendor/guzzlehttp/guzzle/src/Client.php(377): GuzzleHttp\Utils::jsonEncode(Array)
#1 src/vendor/guzzlehttp/guzzle/src/Client.php(328): GuzzleHttp\Client->applyOptions(Object(GuzzleHttp\Psr7\Request), Array)
#2 src/vendor/guzzlehttp/guzzle/src/Client.php(169): GuzzleHttp\Client->transfer(Object(GuzzleHttp\Psr7\Request), Array)
#3 src/vendor/guzzlehttp/guzzle/src/ClientTrait.php(207): GuzzleHttp\Client->requestAsync('POST', Object(GuzzleHttp\Psr7\Uri), Array)
#4 src/addons/DigitalPoint/Analytics/GoogleApi/Measurement.php(47): GuzzleHttp\Client->postAsync('https://www.goo...', Array)
#5 src/addons/DigitalPoint/Analytics/GoogleApi/Measurement.php(74): DigitalPoint\Analytics\GoogleApi\Measurement->makeApiCall('https://www.goo...', Array)
#6 src/addons/DigitalPoint/Analytics/Repository/Measurement.php(11): DigitalPoint\Analytics\GoogleApi\Measurement->collect('2cf7dfc4-d973-4...', Array, [invalid], Array, true)
#7 src/addons/DigitalPoint/Analytics/Pub/Controller/Beacon.php(35): DigitalPoint\Analytics\Repository\Measurement->collect('2cf7dfc4-d973-4...', Array, [invalid])
#8 src/XF/Mvc/Dispatcher.php(362): DigitalPoint\Analytics\Pub\Controller\Beacon->actionImage(Object(XF\Mvc\ParameterBag))
#9 src/XF/Mvc/Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass('DigitalPoint\\An...', 'Image', Object(XF\Mvc\RouteMatch), Object(DigitalPoint\Analytics\Pub\Controller\Beacon), NULL)
#10 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(DigitalPoint\Analytics\Pub\Controller\Beacon), NULL)
#11 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#12 src/XF/App.php(2813): XF\Mvc\Dispatcher->run()
#13 src/XF.php(802): XF\App->run()
#14 index.php(23): XF::runApp('XF\\Pub\\App')
#15 {main}
Request state
array(4) {
  ["url"] => string(139) "/b/image.gif?p=jivTVHlp4LR6kakVMejcjlXJAUg6fNH0z6XzB4LGi0qBde5sUfsmTAc%2FGzYxOArymt2W5lwHFNTCP2%2FIYk17raVcfgWtOroDM4A1Rf429kuaRlODFEzWMYCG"
  ["referrer"] => bool(false)
  ["_GET"] => array(1) {
    ["p"] => string(120) "jivTVHlp4LR6kakVMejcjlXJAUg6fNH0z6XzB4LGi0qBde5sUfsmTAc/GzYxOArymt2W5lwHFNTCP2/IYk17raVcfgWtOroDM4A1Rf429kuaRlODFEzWMYCG"
  }
  ["_POST"] => array(0) {
  }
}

Any ideas?
 
Any chance you could send me the encryption key privately? You can get it with this query on your database:

SQL:
SELECT option_value FROM xf_option WHERE option_id = 'baAnalyticsKey';

The key isn't used to hold any major secrets or anything... just the payload when logging emails being viewed (which contains user_id and email subject). But that would let me decrypt the payload in your error to see what might be going on there.
 
same issue...

I'm also getting this error:

Oops! We ran into some problems.
InvalidArgumentException: uid is a reserved parameter_name and cannot be used. in src/addons/DigitalPoint/Analytics/GoogleApi/AbstractApi.php at line 31
  1. DigitalPoint\Analytics\GoogleApi\AbstractApi->makeApiCall() insrc/addons/DigitalPoint/Analytics/GoogleApi/Admin.php at line 123
  2. DigitalPoint\Analytics\GoogleApi\Admin->createCustomDimension() insrc/addons/DigitalPoint/Analytics/Repository/Reporting.php at line 131
  3. DigitalPoint\Analytics\Repository\Reporting->createCustomDimension() insrc/addons/DigitalPoint/Analytics/Repository/Reporting.php at line 121
  4. DigitalPoint\Analytics\Repository\Reporting->createNeededDimensions() insrc/addons/DigitalPoint/Analytics/XF/Admin/Controller/Option.php at line 90
  5. DigitalPoint\Analytics\XF\Admin\Controller\Option->actionGoogleAnalyticsSelect() insrc/XF/Mvc/Dispatcher.php at line 362
  6. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 264
  7. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 121
  8. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 63
  9. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2813
  10. XF\App->run() in src/XF.php at line 802
  11. XF::runApp() in admin.php at line 15

when trying to select property.
@digitalpoint can you please check.

@digitalpoint I'm getting the following error on 2.3:
Code:
GuzzleHttp\Exception\InvalidArgumentException: json_encode error: Malformed UTF-8 characters, possibly incorrectly encoded src/vendor/guzzlehttp/guzzle/src/Utils.php:298
Generated by: Unknown account Aug 30, 2024 at 11:34 PM
Stack trace
#0 src/vendor/guzzlehttp/guzzle/src/Client.php(377): GuzzleHttp\Utils::jsonEncode(Array)
#1 src/vendor/guzzlehttp/guzzle/src/Client.php(328): GuzzleHttp\Client->applyOptions(Object(GuzzleHttp\Psr7\Request), Array)
#2 src/vendor/guzzlehttp/guzzle/src/Client.php(169): GuzzleHttp\Client->transfer(Object(GuzzleHttp\Psr7\Request), Array)
#3 src/vendor/guzzlehttp/guzzle/src/ClientTrait.php(207): GuzzleHttp\Client->requestAsync('POST', Object(GuzzleHttp\Psr7\Uri), Array)
#4 src/addons/DigitalPoint/Analytics/GoogleApi/Measurement.php(47): GuzzleHttp\Client->postAsync('https://www.goo...', Array)
#5 src/addons/DigitalPoint/Analytics/GoogleApi/Measurement.php(74): DigitalPoint\Analytics\GoogleApi\Measurement->makeApiCall('https://www.goo...', Array)
#6 src/addons/DigitalPoint/Analytics/Repository/Measurement.php(11): DigitalPoint\Analytics\GoogleApi\Measurement->collect('2cf7dfc4-d973-4...', Array, [invalid], Array, true)
#7 src/addons/DigitalPoint/Analytics/Pub/Controller/Beacon.php(35): DigitalPoint\Analytics\Repository\Measurement->collect('2cf7dfc4-d973-4...', Array, [invalid])
#8 src/XF/Mvc/Dispatcher.php(362): DigitalPoint\Analytics\Pub\Controller\Beacon->actionImage(Object(XF\Mvc\ParameterBag))
#9 src/XF/Mvc/Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass('DigitalPoint\\An...', 'Image', Object(XF\Mvc\RouteMatch), Object(DigitalPoint\Analytics\Pub\Controller\Beacon), NULL)
#10 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(DigitalPoint\Analytics\Pub\Controller\Beacon), NULL)
#11 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#12 src/XF/App.php(2813): XF\Mvc\Dispatcher->run()
#13 src/XF.php(802): XF\App->run()
#14 index.php(23): XF::runApp('XF\\Pub\\App')
#15 {main}
Request state
array(4) {
  ["url"] => string(139) "/b/image.gif?p=jivTVHlp4LR6kakVMejcjlXJAUg6fNH0z6XzB4LGi0qBde5sUfsmTAc%2FGzYxOArymt2W5lwHFNTCP2%2FIYk17raVcfgWtOroDM4A1Rf429kuaRlODFEzWMYCG"
  ["referrer"] => bool(false)
  ["_GET"] => array(1) {
    ["p"] => string(120) "jivTVHlp4LR6kakVMejcjlXJAUg6fNH0z6XzB4LGi0qBde5sUfsmTAc/GzYxOArymt2W5lwHFNTCP2/IYk17raVcfgWtOroDM4A1Rf429kuaRlODFEzWMYCG"
  }
  ["_POST"] => array(0) {
  }
}

Any ideas?
I think I figured out what might be going on here... The system will use the Sodium PHP extension to encrypt the payload if it's installed, and fall back to base64 encoding if it's not installed. I think you had the Sodium PHP extension installed when the email was sent, but not when the user read the email (it sees Sodium isn't installed, so it assumes it's a base64 encoded string instead of an encrypted string).

When the email is read after the fact, you can't go back in time and regenerate the email to not have an encrypted payload when your server can no longer decrypt what it once was able to encrypt (when it was sent).

So then the system is dealing with what is an invalid string (since it wasn't able to decrypt it). Probably makes sense to add a check to make sure we are dealing with a valid string (and simply not log events for users opening emails when we can't get the info we need to do so).

That being said, the best solution is going to be install the Sodium PHP extension again in your PHP setup so that they can be logged (and not just ignored).
 
That being said, the best solution is going to be install the Sodium PHP extension again in your PHP setup so that they can be logged (and not just ignored).
The extension was installed but XF is returning this error now:
1725309299074.webp
and sodium is installed:
1725309384466.webp
 
Back
Top Bottom