Newer Version Available
Accessing Usage Metrics Data
The usage data for a package is stored in MetricsDataFile records in your reporting organization. Once you activate the Usage
Metrics feature, one new record is created for all custom objects
and one for all Visualforce pages, per Salesforce instance per day.
The usage data for each day and instance is stored as a text file,
encoded in Base 64, in the MetricsDataFile field
of the record. Other fields in the record identify these properties.
- Namespace prefix of the package
- Salesforce instance
- Start time and date of data collection
- End time and date of data collection
- Size of the data file in bytes
- Type of data, which is either CustomObject or Visualforce
The custom objects data is a snapshot that reflects the state of the organization at the time the database was sampled, while the Visualforce data covers usage over a 24-hour period.
The custom object count is a snapshot captured once each day.
Here’s a section of a sample data file for custom objects. It shows
there were 3500 and 1500 records in the Alpha and
Beta custom objects, respectively, in the specified
customer organization on the specified
day.
1"00Dxx0000001gbk","org1","Enterprise Edition","TRIAL","Alpha", "3500"
2"00Dxx0000001gbk","org1","Enterprise Edition","TRIAL","Beta", "1500"In a record for Visualforce pages, each row of the text file contains usage data in
the following order.
- Organization ID
- Organization name
- Organization edition
- Organization status
- Package version number
- Name of the Visualforce page
- Number of times the page was accessed
- Number of unique users who accessed the page
- Average loading time of the page, in milliseconds
The Visualforce counts for each organization measure the number of times the page was viewed in the duration between the start and end times. Here’s a section of a sample data file for Visualforce pages.
1"00Dxx0000001gbk","org1","Enterprise Edition","TRIAL","1.0","/apex/gm12__f1","1","1","66.0"
2"00Dxx0000001gbk","org1","Enterprise Edition","TRIAL","1.0","/apex/gm12__f2","1","1","128.0"
3"00Dxx0000001gbk","org1","Enterprise Edition","TRIAL","1.0","/apex/gm12__f3","1","1","107.0"
4"00Dxx0000001gbf","org1","Enterprise Edition","TRIAL","1.0","/apex/gm12__f1","5","1","73.6"
5"00Dxx0000001gbf","org1","Enterprise Edition","TRIAL","1.0","/apex/gm12__f2","1","1","72.0"
6"00Dxx0000001gbf","org1","Enterprise Edition","TRIAL","1.0","/apex/gm12__f3","7","1","50.8"You must write a custom process to query the reporting organization to collect the metrics data, and export it to a system of your choice for analysis. This gives you the maximum flexibility to monitor and analyze the usage trends most relevant for your app.