I have a public-facing web mapping application (flex-based), and I need to get the usage/statistics on the layers that people are using, however, a lot of these layers are one of many within a map service (e.g. "Utilities" is a service that has many layers within it). Besides splitting them apart into separate services, what are some ways I can go about tracking this information? As far as I know, ArcGIS Server stats only show usage by service (not the layers within) and Google Analytics only displays information on page views/widget usage.
Take a look at this FlexViewer widget that allows for tracking from Google Analytics. It has EventListeners to listen out for certain events the user is triggering in the interface.
From the above link:
Logging options without extra coding include: Record a log of widgets as they are opened. Record a log of each basemap if it is switched on. Record a log of map's interactive mode, such as Draw point, line, etc. These options can be set to true in the GoogleAnalyticsWidget.xml file if you wish to log them.
For developers, the widget is also set to listen for a GoogleAnalyticsWidgetEvent. This will allow more detalied logging options by dispatching a GoogleAnalyticsWidgetEvent anywhere within the flexviewer code. For example if you wanted to log each time the search button is clicked on myWidget, you would add the following to the buttons click event.
Would not be too hard to add a new event listener for individual layers within a map service.
With that said - I prefer the line of thinking Kirk mentions in his comment through using a Service Object Interceptor. Flex has been retired by Esri and the majority of browsers out there. It would be a more futureproof path to look at an SOI os possibly an Esri partner that provides more advanced logging such as GeoCortex Analytics.