Have a look at Gyde.ai. That is a digital adaptation platform that could help you. (great value for money). Alternatively, you can write your own JS, and store values in the Domain Model. See a link for inspiration. The last option is to implement the tracking in Microflows and Nanoflows.
When storing the data in your Domain Model, create some logic cleaning up the records, as the data will grow fast. Gyde.ai stores the data in your cloud tenant.