New to Claude Skills? Learn how to install them →

forcedotcom on GitHub

App Analytics Query

OfficialFree

Efficiently manage and retrieve ISV app usage data.

Get this skill

Free · Opens the source repo

What App Analytics Query does

The dx-app-analytics-query skill facilitates the retrieval and management of usage analytics for ISV applications on the Salesforce platform. It allows developers to create AppAnalyticsQueryRequest records to asynchronously query usage data for managed packages. This skill is particularly useful for ISV partners who need to analyze application performance, understand subscriber behavior, and configure settings related to App Analytics. By utilizing the REST and Metadata APIs, users can efficiently handle various aspects of app analytics, from querying data to configuring simulation modes for testing purposes.

When using this skill, developers can specify different data types, such as PackageUsageSummary, PackageUsageLog, or SubscriberSnapshot, and set time ranges for their queries. The skill also provides detailed lifecycle management for queries, allowing users to track the status of their requests through various states, including New, Pending, Complete, and Expired. This capability is crucial for ensuring that data retrieval is timely and that any issues can be addressed promptly.

Additionally, the skill supports configuration of AppAnalyticsSettings, enabling users to control simulation modes and opt-out behaviors. This is particularly beneficial for testing scenarios where real subscriber data should not be used. Overall, this skill is designed for Salesforce developers and ISV partners looking to leverage app analytics to enhance their applications and make data-driven decisions.

When to use it

Use this skill when you need to query managed package usage data or configure App Analytics settings for your Salesforce applications.

When not to use it

This skill is not suitable for standard Salesforce reports or custom SOQL queries; use appropriate reporting or SOQL skills instead.

What you can build with it

Query Package Usage Summary

Use the skill to create a query for package usage summary data for the last 7 days, specifying the appropriate time range and data type.

Configure Simulation Mode

Deploy AppAnalyticsSettings to enable simulation mode, allowing for testing with sample data instead of real subscriber data.

Troubleshoot Failed Queries

Utilize the skill to check the status of your analytics queries and diagnose any failures by examining the error messages.

How to install App Analytics Query

View source

1. Install with the skills CLI

npx skills add forcedotcom/sf-skills/dx-app-analytics-query --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by forcedotcom

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
  • Working with Data Cloud SQL or DMOs → data360-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>

Frequently asked questions about App Analytics Query

Similar skills