Get Shopify Analytics Data or Reports by API

I manage multiple Shopify stores and am currently developing an app to retrieve Shopify reports. My goal is to ensure that the reports generated match exactly with the ones provided by Shopify.

I have already attempted to fetch data using Shopify’s GraphQL API and aggregate it manually. However, I have encountered discrepancies, and the data is not 100% accurate.

Could you advise if there is an alternative approach, such as creating a custom Shopify app or utilizing another method, to obtain accurate reports?

Kindly help Thanks.

1 Like

Hi onlyibrahim,

Can you describe the discrepancies/ inaccuracies? With the upcoming deprecation of ShopifyQL we do recommend using the Admin API (specifically querying order data) to get sales analytics data.

Hi Liam,

I’m experiencing similar issues. My team has spent the past few months trying to reconcile total sales and net sales from the GQL API with the values shown in the Shopify Analytics Dashboard. We’ve been following the provided formulas carefully.

For example, to calculate net sales, we take the subtotalPriceSet for the specified time range (ensuring correct time zones and currency) and subtract refunds/returns by summing each refund line item from the order’s subtotalSet. We also ensure that returns are only deducted if they occurred within our specified time range.

However, the values we get often don’t match the sales report. While the discrepancies are small, they create confusion. I would expect to get the same values as shown in the Shopify Dashboard.

Could you provide guidance on how to improve our calculations using the GQL API to ensure better accuracy?

I solved this problem by using totalReceived - totalRefunded amount(minus from totalReceived which createdAt is same as the refund’s createdAt)

Great to hear you found a solution for this Fuga - and I appreciate you posting the approach that worked for you.

If you run into any more issues please let us know.

1 Like