appstore-connect-sdk
appstore-connect-sdk copied to clipboard
App Analytics
Tried to get App Analytics working, but did not get all the way through with the following:
// Retrieve app analytics data for the TestFlight app
const getAppAnalyticsData = async (api: any) => {
try {
// Define the time period for the app analytics data you want to retrieve
const startTime = Math.floor(Date.now() / 1000) - (24 * 60 * 60);
const endTime = Math.floor(Date.now() / 1000);
// Define the query parameters for the App Store Connect API request
const queryParams: QueryParams = {
'filter[timeRange][start]': startTime,
'filter[timeRange][end]': endTime,
'filter[version]': bundleId,
'group[granularity]': 'DAY',
'measure': 'installs,uninstalls'
};
const url = `/v1/analytics/applications/${appId}/data`;
const method = 'GET';
const data = await api.request(url, method, queryParams)
return data;
} catch (error) {
console.error(error);
}
};
Others are trying as well
- https://developer.apple.com/forums/thread/718674
- https://developer.apple.com/forums/thread/29421
- https://developer.apple.com/forums/thread/115392?page=2
I am also looking for a way to query analytics data. Unfortunately, Apple does not currently open the relevant API.
This is helpful in any way?
https://developer.apple.com/documentation/appstoreconnectapi/read_report_requests
Its in the spec as apps-analyticsReportRequests-get_to_many_related