isaced / appstore-connect-sdk

A TypeScript module for Node.js that interacts with the App Store Connect API, providing support for all APIs based on OpenAPI specification.
MIT License
27 stars 8 forks source link

App Analytics #6

Open chessbyte opened 1 year ago

chessbyte commented 1 year ago

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

isaced commented 1 year ago

I am also looking for a way to query analytics data. Unfortunately, Apple does not currently open the relevant API.

fdelucchijr commented 2 months ago

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