Thank you for the information. It’s clear now that you’re calling the \WP_STATISTICS\Pages::record()
method directly.
The error you’re encountering, “Uncaught ArgumentCountError: Too few arguments to function WP_STATISTICS\Pages::record(), 0“, is because this method now requires an argument, specifically an instance of \WP_Statistics\Service\Analytics\VisitorProfile
.
In the recent updates, the method signatures and expected parameters have been adjusted. While we typically anticipate developers to use the Hits::record()
method, which internally handles the instantiation and passing of the required parameters, direct calls to Pages::record()
need to be updated accordingly.
Here’s how you can adjust your code to accommodate the new method signature:
$visitorProfile = new \WP_Statistics\Service\Analytics\VisitorProfile();
\WP_STATISTICS\Pages::record($visitorProfile);
If you have any further questions or need additional assistance, please don’t hesitate to reach out.
Best