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 requested site member.
If a counter does not yet exist, it will be created.
Counters are set under a custom key, which is an ID for the counter, and is unique.
Members are typically associated with a contact, each having a distinct member and contact ID. When specifying the ID as a parameter, avoid presuming the IDs are identical since they represent separate entities.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function setActivityCounters(
memberId: string,
counter: Counter,
): Promise<SetActivityCountersResponse>;
ID of the member to upsert an activity counter for.
Details of the counter to be set.
import { activityCounters } from "wix-activity-counters.v2";
async function setActivityCounters(memberId, counter) {
try {
const result = await activityCounters.setActivityCounters(
memberId,
counter,
);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.