The anonymous usage statistics in XenForo

cmd

Collaborate
Collaborate
Registered
Joined
Feb 18, 2020
Messages
217
Points
73

Reputation:

"ACP -> Setup -> Options -> Statistics and metrics -> Send anonymous usage statistics" is the path to where you can toggle if XenForo is allowed to collect statistics regarding your install. But has anyone ever found or compiled a full list of what this feature collects?

Their description in the ACP for the feature is; "XenForo would like to collect some anonymous statistics including information about PHP, MySQL, and your XenForo installation."—but that doesn't tell anyone about what data it collects in total. There is more to PHP than just PHP, and the same goes with MySQL, you get the point.

All data I've been able to find myself that they collect is your PHP version, more than that I have not yet been able to see as of writing this.
 

cmd

Collaborate
Collaborate
Registered
Joined
Feb 18, 2020
Messages
217
Points
73

Reputation:

Update to this for anyone curious:

It seems that all data this feature collects, according to XenForo, is MySQL version, PHP version, and XenForo version. While this might've changed and I just haven't found that article yet, that is at least a part of what they seem to collect.

@ENXF NET do you know which PHP file the analytics feature is stored in by any chance?
 

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
19,151
Points
823

Reputation:

I don't know this :cry:
 

cmd

Collaborate
Collaborate
Registered
Joined
Feb 18, 2020
Messages
217
Points
73

Reputation:

I hope I can find it then myself ☹
 

Soft4Win

Developer
Staff member
Moderator
Collaborate
Registered
Joined
Apr 27, 2019
Messages
370
Points
103

Reputation:

I looked into it and found what exactly XenForo is fetching. It fetches, installation_id, php version,mysql version, xenforo version, addons of xenforo you are using, and third party addons you are using.


PHP:
return [
            'installation_id' => $config['installation_id'],
            'php' => $this->getPhpVersionString(),
            'mysql' => $this->getMySqlVersionString(),
            'xf' => \XF::$version,
            'first_party_ids' => $firstPartyIds,
            'third_party_count' => count($thirdPartyIds),
        ];

If you want to look into it than here is the trackdown for it :-

1. Admin Option :- src/XF/Option/CollectServerStats.php
2. Job Through which it runs the collect query :- src/XF/Job/CollectStats.php
3. Repository through which it collects data :- xrc/XF/Repository/CollectStats.php , function collectStats() is used for collecting the data.
 
Last edited:

Soft4Win

Developer
Staff member
Moderator
Collaborate
Registered
Joined
Apr 27, 2019
Messages
370
Points
103

Reputation:

While looking into it further, i realized that it does take the record of all Xenforo Addons you have installed like resource manager, media manager etc.. but for third party addons, it only counts the total no. of third party addons you are having.
 

Soft4Win

Developer
Staff member
Moderator
Collaborate
Registered
Joined
Apr 27, 2019
Messages
370
Points
103

Reputation:

Until now i wasn't aware of the fact that they also takes the addonId of addons we have installed.
 

SNap!

Collaborate
Collaborate
Registered
Joined
Mar 17, 2022
Messages
555
Points
253

Reputation:

not so important, only work with API URL

PHP:
    protected function performStatsCollection()
    {
        /** @var \XF\Repository\CollectStats $collectStatsRepo */
        $collectStatsRepo = $this->app->repository('XF:CollectStats');

        if (!$collectStatsRepo->isEnabled())
        {
            return;
        }

        $success = true;
        $error = null;

        $stats = $collectStatsRepo->collectStats();
        if ($stats)
        {
            $client = $this->app->http()->client();

            try
            {
                $response = $client->post(\XF::XF_API_URL . 'submit-stats.json', [
                    'exceptions' => false,
                    'form_params' => [
                        'stats' => $stats
                    ]
                ]);

                $responseJson = \GuzzleHttp\json_decode($response->getBody()->getContents(), true);

                if ($response->getStatusCode() !== 200)
                {
                    $success = false;
                    if (isset($responseJson['error']))
                    {
                        $error = reset($responseJson['error']);
                    }
                    else
                    {
                        $error = 'An unexpected error occurred.';
                    }
                }
            }
            catch (\Exception $e)
            {
                $success = false;
                $error = $e->getMessage();
            }
        }
 
Top