Search.../

setActivityCounters( )

Developer Preview

Sets activity counters for a member.

Description

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.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function setActivityCounters(memberId: string, counter: Counter): Promise<SetActivityCountersResponse>

setActivityCounters Parameters

NAME
TYPE
DESCRIPTION
memberId
string

ID of the member to upsert an activity counter for.

counter
Counter

Details of the counter to be set.

Returns

Upserted activity counter.

Return Type:

Promise<
SetActivityCountersResponse
>
NAME
TYPE
DESCRIPTION
activityCounter
ActivityCounter

Information about a member's activity counter.

Was this helpful?

setActivityCounters example

Copy Code
1import { activityCounters } from 'wix-activity-counters.v2';
2
3 async function setActivityCounters(memberId, counter) {
4 try {
5 const result = await activityCounters.setActivityCounters(memberId, counter);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13