Setup

To use the ActivityCounters API, install the @wix/activity-counters package using npm or Yarn:

Copy
1
npm install @wix/activity-counters

or

Copy
1
yarn add @wix/activity-counters

Then import { activityCounters } from @wix/activity-counters:

Copy
1
import { activityCounters } from '@wix/activity-counters'
Was this helpful?
Yes
No

getActivityCounters( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves activity counters.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Activity Counters
Read Activity Counters
Learn more about permission scopes.
Copy
function getActivityCounters(memberId: string): Promise<GetActivityCountersResponse>
Method Parameters
memberIdstringRequired
ID of the member to retrieve activity counters for.
Returns
Return Type:Promise<GetActivityCountersResponse>
Was this helpful?
Yes
No

queryActivityCounters( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Returns up to 100 activity counters for the provided filter and paging.

Service will return only counters that are marked as public, or private counters from apps created by the requesting third party.

Supported fields for filtering:

  • memberId

Supported operations: Comparison:

  • $eq
  • $ne
  • $in Logical:
  • $and
  • $not
  • $or
PROPERTYSUPPORTED FILTERS & SORTING
memberIdeq(),ne(),in()

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Activity Counters
Read Activity Counters
Learn more about permission scopes.
Copy
function queryActivityCounters(): ActivityCountersQueryBuilder
Request
This method does not take any parameters
Returns
Was this helpful?
Yes
No

setActivityCounters( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Sets activity counters for a member.

If a counter doesn't exist, it's created.

Counters are set under a custom key, which is an ID for the counter, and is unique per app.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Activity Counters
Learn more about permission scopes.
Copy
function setActivityCounters(memberId: string, counter: Counter): Promise<SetActivityCountersResponse>
Method Parameters
memberIdstringRequired
ID of the member to upsert an activity counter for.

counterCounterRequired
Details of the counter to be set.
Returns
Return Type:Promise<SetActivityCountersResponse>
Was this helpful?
Yes
No