> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: getMemberCountsPerBadge() # Method package: wixMembersV2 # Method menu location: wixMembersV2 --> badges --> getMemberCountsPerBadge # Method Link: https://dev.wix.com/docs/velo/apis/wix-members-v2/badges/get-member-counts-per-badge.md # Method Description: Retrieves member count per badge. The `getMemberCountsPerBadge` function returns a Promise that resolves when the member counts of each badge are retrieved. This function is not a universal function and runs only on the backend. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Get member count for badge. ```javascript import { badges } from 'wix-members.v2'; import { elevate } from 'wix-auth'; export async function myGetMemberCountsPerBadgeFunction() { try { const elevatedMemberCountsPerBadge = elevate(badges.getMemberCountsPerBadge); const badgeMemberCounts = await elevatedMemberCountsPerBadge() console.log('Member count per badge: ', badgeMemberCounts); return badgeMemberCounts; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "badgeMemberCounts": [ * { * "badgeId": "b657b857-774a-4dde-9b0e-f364d61092ea", * "memberCount": 0 * }, * { * "badgeId": "e80fed60-687e-4b91-a24c-252c4b32227b", * "memberCount": 1 * }, * { * "badgeId": "215be5d9-4b32-4861-9eb5-2152930dd0b4", * "memberCount": 1 * } * ] * } */ ``` ## Get member count for badge. (export from backend code) ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { badges } from 'wix-members.v2'; import { elevate } from 'wix-auth'; export const myGetMemberCountsPerBadgeFunction = webMethod(Permissions.Anyone, async () => { try { const elevatedMemberCountsPerBadge = elevate(badges.getMemberCountsPerBadge); const badgeMemberCounts = await elevatedMemberCountsPerBadge() console.log('Member count per badge: ', badgeMemberCounts); return badgeMemberCounts; } catch (error) { console.error(error); // Handle the error } }); /* Promise resolves to: * { * "badgeMemberCounts": [ * { * "badgeId": "b657b857-774a-4dde-9b0e-f364d61092ea", * "memberCount": 0 * }, * { * "badgeId": "e80fed60-687e-4b91-a24c-252c4b32227b", * "memberCount": 1 * }, * { * "badgeId": "215be5d9-4b32-4861-9eb5-2152930dd0b4", * "memberCount": 1 * } * ] * } */ ``` ---