Dx App Analytics Query

forcedotcom/sf-skills/plugins/builder/dx-isv-partner/skills/dx-app-analytics-query

作者 forcedotcome5164d94d7511c00fa02a5b8b60754b2361e178f無授權條款1K 個星標收錄於 2026年10月9日更新於 2026年10月9日儲存庫昨天更新

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 querying-soql), or Data Cloud query/search (use retrieving-datacloud).

僅含說明Data & Analytics
AI 產生的概覽

指導透過 AppAnalyticsQueryRequest 與 AppAnalyticsSettings 查詢 Salesforce ISV App Analytics 使用資料。

功能
說明 AppAnalyticsQueryRequest sObject 與 AppAnalyticsSettings 中繼資料類型,包括其欄位、可用值與請求生命週期狀態。介紹如何透過 REST/sObject API 建立並輪詢分析查詢記錄、選擇資料類型、時間範圍、檔案格式與壓縮方式,並下載結果。也涵蓋模擬模式設定以及下載連結過期等常見問題排查重點。
適用情境
適用於取得受控套件使用資料、查詢訂閱者快照、設定 App Analytics 模擬模式或退出設定,以及排查失敗或過期的分析查詢。不適用於標準 CRM SOQL、報表與儀表板或 Data Cloud 查詢。
執行需求
需要 Salesforce API 存取權,並安裝 sf CLI(2.0.0 或更新版本),API 版本需為 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
  • Working with Data Cloud SQL or DMOs → retrieving-datacloud
  • Building reports/dashboards on standard objects → reporting skills
  • Deploying or retrieving generic metadata XML → deploying-metadata / 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

text
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:

bash
POST /services/data/v60.0/sobjects/AppAnalyticsQueryRequestContent-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

text
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>

來源與署名

來源:forcedotcom/sf-skills位於plugins/builder/dx-isv-partner/skills/dx-app-analytics-query提交e5164d9

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架