You shouldn’t communicate with the CosmosDB directly from the website user counter as this would expose security vulnerabilities. Instead, create the code that performs the read/update action in the CosmosDB as an API. You call this API from the user counter and the API then connects with the CosmosDB and returns the data.
Goal 1: Get Azure function talking to the database
Create an Azure Function using Python
Setup Bindings between the function and the database