App Analytics
Stripe 为已发布的 marketplace apps 提供内置 analytics,让您了解安装情况、listing 性能和用户参与度。您也可以使用 webhooks 和 Stripe API 构建自定义 analytics。
可用报告
Stripe Dashboard 为已发布的 app 提供以下 analytics:
安装指标
| 指标 | 描述 |
|---|---|
| Installs | 所选时期内新 app 安装总数 |
| Uninstalls | 所选时期内 app 卸载总数 |
| Cumulative Net Installs | 随时间推移的安装减去卸载的累计总数 |
Listing 性能
| 指标 | 描述 |
|---|---|
| Listing Views | App marketplace listing 页面的总浏览量 |
| Unique Views | 查看过您 marketplace listing 的独立访客数 |
| MoM Conversion Rate | 安装 app 的 listing 浏览者的环比百分比 |
增长指标
| 指标 | 描述 |
|---|---|
| MoM Growth Rate | net installs 的环比增长率 |
| Churn Rate | 每月卸载的已安装用户百分比 |
数据新鲜度
Caution
Analytics 数据有 48 小时延迟。您在 dashboard 中看到的数据反映的是大约两天前的活动。请相应地规划您的报告窗口。
- 数据每天更新,处理延迟为 48 小时
- 历史数据从 app 首次发布之日起可用
- 指标以 UTC 时区计算
- 从 Stripe Dashboard 将数据导出为 CSV 进行外部分析
通过 API 访问 Analytics
您可以使用 Stripe Reporting API 以编程方式访问 app analytics:
安装数据
# Fetch app install reportcurl https://api.stripe.com/v1/reporting/report_runs \ -u sk_live_xxxxx: \ -d "report_type=app.installs.daily" \ -d "parameters[interval_start]=1709251200" \ -d "parameters[interval_end]=1711929600" \ -d "parameters[app_id]=com.tajo.brevo-integration"Listing 浏览量
# Fetch listing views reportcurl https://api.stripe.com/v1/reporting/report_runs \ -u sk_live_xxxxx: \ -d "report_type=app.listing_views.daily" \ -d "parameters[interval_start]=1709251200" \ -d "parameters[interval_end]=1711929600" \ -d "parameters[app_id]=com.tajo.brevo-integration"编程访问(Node.js)
const stripe = require('stripe')('sk_live_xxxxx');
// Create a report run for app installsconst reportRun = await stripe.reporting.reportRuns.create({ report_type: 'app.installs.daily', parameters: { interval_start: Math.floor(new Date('2025-03-01').getTime() / 1000), interval_end: Math.floor(new Date('2025-03-31').getTime() / 1000), app_id: 'com.tajo.brevo-integration', },});
// Poll for report completionconst checkReport = async (reportId) => { const report = await stripe.reporting.reportRuns.retrieve(reportId);
if (report.status === 'succeeded') { // Download the report file const file = await stripe.files.retrieve(report.result.id); console.log('Report URL:', file.url); return file; }
if (report.status === 'failed') { throw new Error('Report generation failed'); }
// Report still processing return null;};Users 标签页
App analytics 中的 Users 标签页显示单个账户级别的数据:
| 列 | 描述 |
|---|---|
| Account ID | 安装了您 app 的 Stripe 账户 |
| Install Date | app 安装时间 |
| Status | 活跃或已卸载 |
| Uninstall Date | app 卸载时间(如适用) |
使用此数据来:
- 跟踪单个账户的激活状态
- 跟进已安装但未完成 onboarding 的账户
- 识别已卸载的账户并了解流失原因
- 将安装数据与您自己的平台 analytics 关联
使用 Webhooks 构建自定义 Analytics
要获得实时 analytics 和更深入的洞察,请设置 webhooks 来跟踪 app 事件:
Webhook 事件
监听这些事件来构建自定义 analytics:
| 事件 | 描述 |
|---|---|
account.application.authorized | 用户安装了您的 app |
account.application.deauthorized | 用户卸载了您的 app |
Webhook Handler
const express = require('express');const stripe = require('stripe')('sk_live_xxxxx');
const app = express();
app.post('/webhooks/stripe-app', express.raw({ type: 'application/json' }), async (req, res) => { const sig = req.headers['stripe-signature']; const webhookSecret = process.env.STRIPE_APP_WEBHOOK_SECRET;
let event;
try { event = stripe.webhooks.constructEvent(req.body, sig, webhookSecret); } catch (err) { console.error('Webhook signature verification failed:', err.message); return res.status(400).send('Webhook signature verification failed'); }
switch (event.type) { case 'account.application.authorized': { const account = event.data.object; console.log('App installed by:', account.id);
// Track in your analytics system await trackEvent('app_installed', { account_id: account.id, timestamp: new Date(event.created * 1000), });
// Trigger onboarding email await sendOnboardingEmail(account.id); break; }
case 'account.application.deauthorized': { const account = event.data.object; console.log('App uninstalled by:', account.id);
// Track churn await trackEvent('app_uninstalled', { account_id: account.id, timestamp: new Date(event.created * 1000), });
// Clean up account data await cleanupAccountData(account.id); break; }
default: console.log('Unhandled event type:', event.type); }
res.json({ received: true });});Connect List API
对于 Connect 平台,使用 Connect List API 获取已安装 app 的账户信息:
const stripe = require('stripe')('sk_live_xxxxx');
// List all connected accounts with your app installedconst getInstalledAccounts = async () => { const accounts = []; let hasMore = true; let startingAfter = null;
while (hasMore) { const params = { limit: 100 }; if (startingAfter) { params.starting_after = startingAfter; }
const response = await stripe.accounts.list(params);
for (const account of response.data) { // Check if your app is installed on this account if (account.settings?.apps?.includes('com.tajo.brevo-integration')) { accounts.push({ id: account.id, email: account.email, created: account.created, }); } }
hasMore = response.has_more; if (response.data.length > 0) { startingAfter = response.data[response.data.length - 1].id; } }
return accounts;};构建自定义 Analytics Dashboard
将 Stripe analytics 与您自己的数据相结合,获得全面视图:
// Aggregate analytics for reportingconst getAppAnalytics = async (startDate, endDate) => { const [stripeInstalls, brevoSyncStats, activationData] = await Promise.all([ // Stripe install data getStripeInstallReport(startDate, endDate), // Brevo sync metrics from Tajo getBrevoSyncMetrics(startDate, endDate), // Activation funnel from your database getActivationFunnel(startDate, endDate), ]);
return { // Acquisition totalInstalls: stripeInstalls.installs, totalUninstalls: stripeInstalls.uninstalls, netInstalls: stripeInstalls.installs - stripeInstalls.uninstalls, listingConversionRate: stripeInstalls.conversionRate,
// Activation onboardingCompleted: activationData.completedOnboarding, brevoConnected: activationData.connectedBrevo, firstSyncCompleted: activationData.firstSyncCompleted, activationRate: activationData.completedOnboarding / stripeInstalls.installs,
// Engagement totalCustomersSynced: brevoSyncStats.totalCustomers, totalEventsSynced: brevoSyncStats.totalEvents, averageSyncFrequency: brevoSyncStats.avgSyncPerDay,
// Retention churnRate: stripeInstalls.uninstalls / stripeInstalls.totalActive, monthlyGrowthRate: stripeInstalls.momGrowth, };};关键指标追踪
对于 Tajo Brevo 集成,重点关注以下指标:
| 指标 | 目标 | 重要原因 |
|---|---|---|
| 安装到激活率 | > 70% | 完成 Brevo 设置的安装者百分比 |
| 首次同步时间 | < 5 分钟 | 用户安装后多快看到价值 |
| 30 天留存率 | > 80% | 30 天后仍活跃的用户百分比 |
| 月度流失率 | < 5% | 通过有价值的集成降低卸载率 |
| Listing 转化率 | > 15% | 安装 app 的 listing 浏览者百分比 |
| 每账户同步客户数 | > 100 | 表明集成使用深度 |
Tip
为重要指标变化设置自动警报。卸载量突然激增或激活率骤降可能表明存在需要立即关注的 bug 或 UX 问题。