The challenge with retrieving unique counts from the Branch API has to do with the way it handles time ranges.
Here’s a breakdown to make it clearer:
Limited Time Window:
The Branch API only lets you pull data for 7 days at a time.
This means that if you want data for a month, you’d have to make multiple requests for each 7-day period and then try to combine them.
Difference from User Interface (UI):
In the Branch web interface (the UI), you can easily set a custom time range—like a whole month—and get the data for that period in one go.
However, in the API, since it’s restricted to 7-day chunks, the data you pull through the API won’t easily match the UI data unless you’re looking at the exact same 7-day timeframe in both.
Unique Counts Don’t Add Up:
Unique counts represent distinct users or events. But adding up daily unique counts for each 7-day period won’t give you the correct unique count for the whole month.
Example: If a user visited on March 1 and again on March 15, they’d be counted as unique in both 7-day chunks (March 1-7 and March 15-21). But for the whole month, they should only be counted once. Summing up smaller unique counts can therefore lead to duplicate counts, inflating the final number.
Example
Goal: You want to know how many unique users visited in March.
Using the UI: You set the date range to March 1-31, and the Branch UI tells you there were 100 unique users in March.
Using the API: You can only pull 7 days at a time, so you’d make four API requests:
March 1-7: 50 unique users
March 8-14: 30 unique users
March 15-21: 40 unique users
March 22-28: 60 unique users
Adding these together (50 + 30 + 40 + 60) gives you 180 users, which is more than what the UI shows because some users were counted more than once across different weeks.
In short, the Branch API’s 7-day limit and the way unique counts work means you can’t directly sum up smaller timeframes to get an accurate monthly unique count.
To learn more about what data you can get from Branch.io as a Custom Connector, please refer to: How to request Branch Query Analytics in Funnel