Indeed the engine provides a class with scene analytics that is enabled when running through the editor. To feed data to the profiler.
pc.app.stats
I think though this class isn’t available when you publish a build. You will have to compile a custom version of the Playcanvas engine to include in your published project, to do what you want.