Counting Captive Portal users

I have programmed the Captival Portal with:

I’m looking to be able to count the number of people who access the CP and either retrieve this data via a hidden page on the web server or physical connection to the ESP after the CP has been running on a battery pack for several hours.

Any help on code tweaking would be greatly appreciated.

Thanks