Campaign Analytics


#1

I’m making an analytics product for creators. I want to get (via the API) the total number of patrons for a campaign and the current amount the creator is earning per month or per post.

I think I can get the patron count for a campaign via this endpoint /api/oauth2/v2/campaigns/{campaign_id}?fields[campaign]=patron_count,pay_per_name.

My issue is finding the total earnings. Do I really have to fetch all of the members for a campaign /api/oauth2/v2/campaigns/{campaign_id}/members, loop over them and use currently_entitled_amount_cents to calculate the total earnings?


#2

Maybe use :

patron_count integer Number of patrons currently registered for this tier.

So, tier_cents*patrons will give what you want without fetching all members.


#3

That makes sense. Thanks ReTwi.


#4

Hi @imns!

Yes, unfortunately we don’t have total pledge sum in the public API. tier_cents * patron_count (per tier) wouldn’t actually work because patrons can pledge more than the their amount (but still be on that tier) and can also pledge without selecting a tier. For the most accurate sum, looping over all members is your best bet.

You can also keep track of this total on your end and have member webhooks come in to update total pledge amounts as they change.

Evy
Platform Engineer