$npx -y skills add forcedotcom/sf-skills --skill dx-app-analytics-queryISV App Analytics metadata types — AppAnalyticsQueryRequest and AppAnalyticsSettings. Use this skill when the user asks about retrieving managed package usage data, configuring App Analytics simulation mode, querying subscriber snapshots, or understanding the AppAnalyticsQueryReq
| 1 | # App Analytics |
| 2 | |
| 3 | ## When This Skill Owns the Task |
| 4 | |
| 5 | Use `dx-app-analytics-query` when the work involves: |
| 6 | - Creating `AppAnalyticsQueryRequest` records via the REST/sObject API |
| 7 | - Configuring `AppAnalyticsSettings` via the Metadata API (simulation mode, opt-out) |
| 8 | - Understanding the query lifecycle: New → Pending → Complete → Expired → Failed |
| 9 | - Choosing between dataType values: PackageUsageSummary, PackageUsageLog, SubscriberSnapshot |
| 10 | - File format and compression options for analytics downloads |
| 11 | - Time-range filtering with startTime, endTime, availableSince |
| 12 | - Troubleshooting failed or expired analytics queries |
| 13 | |
| 14 | Delegate elsewhere when the user is: |
| 15 | - Running standard CRM SOQL queries → platform-soql-query |
| 16 | - Working with Data Cloud SQL or DMOs → data360-query |
| 17 | - Building reports/dashboards on standard objects → reporting skills |
| 18 | - Deploying or retrieving generic metadata XML → platform-metadata-deploy / retrieving-metadata |
| 19 | |
| 20 | --- |
| 21 | |
| 22 | ## Available Types |
| 23 | |
| 24 | ### AppAnalyticsQueryRequest (REST/sObject API) |
| 25 | |
| 26 | An asynchronous query request that ISV partners use to retrieve usage analytics data for their managed packages from the ISV Intelligence Data Lake. Records are created via `POST /services/data/vXX.0/sobjects/AppAnalyticsQueryRequest` and polled via `GET /services/data/vXX.0/sobjects/AppAnalyticsQueryRequest/<id>`. The system processes the query and provides a presigned download URL upon completion. |
| 27 | |
| 28 | **Fields (14 properties):** |
| 29 | |
| 30 | | Field | Type | Description | |
| 31 | |-------|------|-------------| |
| 32 | | DataType | string (filterable) | Type of analytics data. Values: `PackageUsageSummary`, `PackageUsageLog`, `SubscriberSnapshot` | |
| 33 | | RequestState | string (filterable) | Processing status. Values: `New`, `Pending`, `Complete`, `Expired`, `Failed`, `NoData`, `Delivered` | |
| 34 | | StartTime | string | Start of time range for requested data | |
| 35 | | EndTime | string | End of time range. Should be set on an hour boundary | |
| 36 | | AvailableSince | string | Limits query to data indexed after this time (inclusive). Use for incremental retrieval | |
| 37 | | PackageIds | string | Comma-delimited list of managed package IDs (033-prefix) | |
| 38 | | OrganizationIds | string | Comma-delimited list of subscriber org IDs to filter results | |
| 39 | | DownloadUrl | string | Presigned URL for downloading results. Populated when RequestState is Complete | |
| 40 | | DownloadSize | long | Size in bytes of the result data file | |
| 41 | | DownloadExpirationTime | string | Time at which the download URL expires | |
| 42 | | FileType | string (filterable) | Output format. Values: `csv`, `parquet` | |
| 43 | | FileCompression | string (filterable) | Compression. Values: `none`, `gzip`, `snappy` | |
| 44 | | QuerySubmittedTime | string | Time the query was submitted to the Data Lake | |
| 45 | | ErrorMessage | string | Diagnostic message for failed queries | |
| 46 | |
| 47 | ### AppAnalyticsSettings (Metadata API) |
| 48 | |
| 49 | Configuration settings for ISV App Analytics that control simulation mode and opt-out behavior. Deployed via the Metadata API (`sf project deploy`) or Tooling API. |
| 50 | |
| 51 | **Fields (2 properties):** |
| 52 | |
| 53 | | Field | Type | Description | |
| 54 | |-------|------|-------------| |
| 55 | | enableSimulationMode | boolean (filterable) | When true, allows querying sample usage logs for integration testing without real subscriber data | |
| 56 | | enableAppAnalyticsOptOut | boolean (filterable) | When true, opts this subscriber org out of AppExchange App Analytics data collection | |
| 57 | |
| 58 | --- |
| 59 | |
| 60 | ## Request Lifecycle |
| 61 | |
| 62 | ```text |
| 63 | New → Pending → Complete → (download within expiration window) |
| 64 | → Expired (download URL no longer valid) |
| 65 | → Delivered (download confirmed received) |
| 66 | → Failed (check errorMessage) |
| 67 | → NoData (no matching records for the criteria) |
| 68 | ``` |
| 69 | |
| 70 | --- |
| 71 | |
| 72 | ## Common Patterns |
| 73 | |
| 74 | ### Query Package Usage Summary (last 7 days) |
| 75 | |
| 76 | Create a record via the REST API: |
| 77 | |
| 78 | ```bash |
| 79 | POST /services/data/v60.0/sobjects/AppAnalyticsQueryRequest |
| 80 | Content-Type: application/json |
| 81 | |
| 82 | { |
| 83 | "DataType": "PackageUsageSummary", |
| 84 | "StartTime": "<7-days-ago>T00:00:00Z", |
| 85 | "EndTime": "<today-on-hour-boundary>T00:00:00Z", |
| 86 | "PackageIds": "033XXXXXXXXXXXX", |
| 87 | "FileType": "csv", |
| 88 | "FileCompression": "gzip" |
| 89 | } |
| 90 | ``` |
| 91 | |
| 92 | Poll the record via GET until `RequestState` reaches `Compl |