I added some code in the UserSerializer.php file to get the statistics.
Then try to modify the app.js file (In the System.register ('flarum/components/indexPage' section)
key: 'RightItems',
value: function RightItems() {
var items = new ItemList();
var user = app.session.user;
items.add('nav', m(
'div',
{ className: 'ButtonGroup' },
...
'span',
{ className: 'countTitle countMun' },
user.data.attributes.totalUser
)

Here I can only use var user = app.session.user; make it work, but this program only applies to registered users.
Does someone have a clue let it work in the visitor?
(I'm just a graphic designer and I know very little about php and js ?)