Any experiments requires the collection of data. Unity isn’t strictly made for doing experiments (it is a game-engine after all), so there aren’t any built-in solutions to achieve this. This page lists some different methods to solve this problem.
You could choose to write your own custom package. However, others have gone before you. One of such projects you can find in the page listed below.
There are some frameworks specifically designed for doing experiments, like the Unity Experiment Framework.
These allow you to log data in Unity, as well as create custom loggers, as explained here.