PluginBench
Skill
Pass
Audit score 90

dx-app-analytics-query

forcedotcom/sf-skills

Query ISV App Analytics data for managed packages via REST API with async request lifecycle management.

What is dx-app-analytics-query?

This skill handles AppAnalyticsQueryRequest and AppAnalyticsSettings metadata types for ISV partners retrieving managed package usage analytics. Use it when you need to create async analytics queries, configure simulation mode, or understand the query lifecycle (New → Pending → Complete → Expired).

  • Create AppAnalyticsQueryRequest records to retrieve PackageUsageSummary, PackageUsageLog, or SubscriberSnapshot data
  • Poll query status and download results via presigned URLs with expiration tracking
  • Configure AppAnalyticsSettings to enable simulation mode for testing or opt-out behavior
  • Filter queries by time range (startTime, endTime, availableSince), package IDs, and subscriber org IDs
  • Choose output formats (CSV or Parquet) and compression (none, gzip, snappy)
  • Troubleshoot failed or expired queries via RequestState and ErrorMessage fields

How to install dx-app-analytics-query

npx skills add https://github.com/forcedotcom/sf-skills --skill dx-app-analytics-query
Prerequisites
  • Salesforce CLI (sf) version 2.0.0 or later
  • API version 56.0 or higher in target org
  • ISV managed package with App Analytics enabled
  • REST API or Metadata API access to create and query AppAnalyticsQueryRequest records
Claude Code
Cursor
Windsurf
Cline

How to use dx-app-analytics-query

  1. 1.Install the skill via npx skills add with the provided GitHub URL
  2. 2.Create an AppAnalyticsQueryRequest record by POST to /services/data/vXX.0/sobjects/AppAnalyticsQueryRequest with DataType, StartTime, EndTime, and PackageIds
  3. 3.Poll the request via GET until RequestState reaches Complete or Failed
  4. 4.Check DownloadExpirationTime and retrieve the file from DownloadUrl before expiration
  5. 5.For incremental queries, set AvailableSince to your last successful query completion timestamp
  6. 6.Deploy AppAnalyticsSettings via Metadata API to enable simulation mode or opt-out behavior

Use cases

Good for
  • Retrieve 7-day package usage summaries for ISV analytics dashboards
  • Set up incremental data retrieval using AvailableSince to avoid re-downloading
  • Enable simulation mode in AppAnalyticsSettings to test analytics queries with sample data before production
  • Download large subscriber snapshot datasets in Parquet format with Snappy compression for performance
  • Monitor query lifecycle and handle expired download URLs before data becomes unavailable
Who it's for
  • ISV (Independent Software Vendor) partners managing managed packages
  • Salesforce developers building analytics integrations for AppExchange apps
  • DevOps engineers automating subscriber usage data collection and reporting

dx-app-analytics-query FAQ

What's the difference between AppAnalyticsQueryRequest and standard Salesforce reports?

AppAnalyticsQueryRequest is an async sObject API for ISVs to retrieve managed package usage analytics from the ISV Intelligence Data Lake. Standard reports query your org's own CRM data. Use this skill for package analytics; use reporting skills for CRM dashboards.

How long do download URLs stay valid?

Download URLs expire at the timestamp in DownloadExpirationTime. Always check this field before attempting download, as expired URLs cannot be recovered—you must create a new query.

Should I use 033-prefix or 04t-prefix package IDs?

Use 033-prefix managed package IDs in PackageIds, not 04t package version IDs. The 033 ID identifies the package itself across all versions.

Can I query AppAnalyticsQueryRequest synchronously?

No. AppAnalyticsQueryRequest is always asynchronous—the ISV Intelligence Data Lake processes queries in the background. You must poll RequestState until it reaches Complete, Expired, Failed, or NoData.

What's the best format for large analytics datasets?

Use FileType: parquet with FileCompression: snappy for optimal performance and file size on large subscriber snapshot or usage log exports.

Full instructions (SKILL.md)

Source of truth, from forcedotcom/sf-skills.


name: dx-app-analytics-query description: "ISV 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 AppAnalyticsQueryRequest lifecycle (New → Pending → Complete → Expired). TRIGGER when: user mentions App Analytics, AppAnalyticsQueryRequest, AppAnalyticsSettings, package usage data, subscriber analytics, ISV analytics, or simulation mode for app analytics. DO NOT TRIGGER when: the task is about standard Salesforce reports/dashboards (use reporting skills), custom SOQL on Account/Contact (use platform-soql-query)." metadata: cliTools: - tool: ["sf"] semver: ">=2.0.0" relatedSkills: - "platform-metadata-deploy" - "platform-soql-query" version: "1.0" domains: ["Developer Experience"] minApiVersion: "56.0"

App Analytics

When This Skill Owns the Task

Use dx-app-analytics-query when the work involves:

  • Creating AppAnalyticsQueryRequest records via the REST/sObject API
  • Configuring AppAnalyticsSettings via the Metadata API (simulation mode, opt-out)
  • Understanding the query lifecycle: New → Pending → Complete → Expired → Failed
  • Choosing between dataType values: PackageUsageSummary, PackageUsageLog, SubscriberSnapshot
  • File format and compression options for analytics downloads
  • Time-range filtering with startTime, endTime, availableSince
  • Troubleshooting failed or expired analytics queries

Delegate elsewhere when the user is:

  • Running standard CRM SOQL queries → platform-soql-query
  • Building reports/dashboards on standard objects → reporting skills
  • Deploying or retrieving generic metadata XML → platform-metadata-deploy / retrieving-metadata

Available Types

AppAnalyticsQueryRequest (REST/sObject API)

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.

Fields (14 properties):

FieldTypeDescription
DataTypestring (filterable)Type of analytics data. Values: PackageUsageSummary, PackageUsageLog, SubscriberSnapshot
RequestStatestring (filterable)Processing status. Values: New, Pending, Complete, Expired, Failed, NoData, Delivered
StartTimestringStart of time range for requested data
EndTimestringEnd of time range. Should be set on an hour boundary
AvailableSincestringLimits query to data indexed after this time (inclusive). Use for incremental retrieval
PackageIdsstringComma-delimited list of managed package IDs (033-prefix)
OrganizationIdsstringComma-delimited list of subscriber org IDs to filter results
DownloadUrlstringPresigned URL for downloading results. Populated when RequestState is Complete
DownloadSizelongSize in bytes of the result data file
DownloadExpirationTimestringTime at which the download URL expires
FileTypestring (filterable)Output format. Values: csv, parquet
FileCompressionstring (filterable)Compression. Values: none, gzip, snappy
QuerySubmittedTimestringTime the query was submitted to the Data Lake
ErrorMessagestringDiagnostic message for failed queries

AppAnalyticsSettings (Metadata API)

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.

Fields (2 properties):

FieldTypeDescription
enableSimulationModeboolean (filterable)When true, allows querying sample usage logs for integration testing without real subscriber data
enableAppAnalyticsOptOutboolean (filterable)When true, opts this subscriber org out of AppExchange App Analytics data collection

Request Lifecycle

New → Pending → Complete → (download within expiration window)
                         → Expired (download URL no longer valid)
                         → Delivered (download confirmed received)
         → Failed (check errorMessage)
         → NoData (no matching records for the criteria)

Common Patterns

Query Package Usage Summary (last 7 days)

Create a record via the REST API:

POST /services/data/v60.0/sobjects/AppAnalyticsQueryRequest
Content-Type: application/json

{
  "DataType": "PackageUsageSummary",
  "StartTime": "<7-days-ago>T00:00:00Z",
  "EndTime": "<today-on-hour-boundary>T00:00:00Z",
  "PackageIds": "033XXXXXXXXXXXX",
  "FileType": "csv",
  "FileCompression": "gzip"
}

Poll the record via GET until RequestState reaches Complete, then download from DownloadUrl.

Incremental Data Retrieval

Set AvailableSince to the timestamp of your last successful query completion to avoid re-downloading data you already have.

Enable Simulation Mode for Testing

Deploy AppAnalyticsSettings via Metadata API with enableSimulationMode: true to query sample data without real subscribers.


High-Signal Gotchas

  • AppAnalyticsQueryRequest is an sObject — create and poll records via the REST Data API (/sobjects/AppAnalyticsQueryRequest), NOT via Metadata API XML deployment.
  • AppAnalyticsQueryRequest does NOT have Apex triggers and does NOT flow through custom objects or Flows.
  • Download URLs expire — always check DownloadExpirationTime before attempting download.
  • EndTime should be set on an hour boundary for consistent results.
  • AvailableSince is inclusive — data indexed at exactly that timestamp will be included.
  • PackageIds uses 033-prefix IDs, not 04t (package version) IDs.
  • Data is processed asynchronously by the ISV Intelligence Data Lake infrastructure. There is no synchronous query option.
  • FileType: parquet with FileCompression: snappy gives optimal performance for large datasets.

Output Format

Analytics task: <query / configure / troubleshoot>
Data type: <PackageUsageSummary / PackageUsageLog / SubscriberSnapshot>
Package IDs: <033-prefixed IDs>
Time range: <startTime> to <endTime>
File format: <csv|parquet> / <none|gzip|snappy>
Request state: <current state>
Next step: <poll for completion / download / investigate failure>