A common approach to this is to simply use any of the numerous Web statistic tracking services available, or to roll your own.
The idea is simple enough. Web tracking software simply records every "hit" to a particular URL, along with some supporting information. You can make up URLs for specific game resources or events to use for tracking things in your game. You can either use paths in the URL or query parameters to encode extra information, plus the built-in stats these services offer (like "time on site" to see how long a user is on a particular level by pinging the level URL every so often, or time of day to see when people are on your game, or what regions your game is popular in, etc.).
For example, you might player metrics by using URLs like:
You can track performance characters by posting to URLs like:
Building your own service for this is fairly straight forward. You need at minimum just a simple HTTP server somewhere that logs requests, and then one of the myriad of log processing scripts out there that are so popular with Web administrators.
Generating these calls is likewise quite simple using any HTTP library. If you are building in a browser, you can just use the built-in XmlHttpRequest support to generate the hits.
You can alternatively use an off-the-shelf solution, such as Google Analytics, Clicky, and so on. They are not going to make it easy to do custom processing of performance characteristics. For that, you're best off with a custom solution that collects those stats with a script and compiles them into useful reports. Also note that some solutions, like Google Analytics, are heavily geared towards Web users only; notable, they only deliver a .js file (which is hosted on their servers and you are not supposed to copy), rather than an actual REST API, because their protocol can and does change without warning. I've seen a team go through some non-trivial effort to embed a JS interpreter just to run the Google Analytics .js files in their standalone game... don't do that, it's wasted effort for a service that isn't even ideal for the target use cases.
I've been told there is an existing off-the-shelf solution for games, but I cannot for the life of me remember its name, and Google has been no help. I may have been told wrong.
Building your own really isn't hard, though. Any half-competent contracted Web programmer (which excludes 97.4% of Web programmers, as a warning) should be able to whip up a complete working solution within a week. You'll obviously want to have a clearer definition of the exact kinds of statistics and events you're looking for.