> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# SetActivityCounters

# Package: activity

# Namespace: ActivityCounters

# Method link: https://dev.wix.com/docs/api-reference/crm/members-contacts/members/activity/activity-counters/set-activity-counters.md

## Permission Scopes:
Manage Activity Counters: SCOPE.DC-MEMBERS.MANAGE-ACTIVITY-COUNTERS

## Introduction

Sets activity counters for a requested site member.

If the counter does not already exist, it will be created.

Counters are identified with a custom key, which must be unique.

> **Note**: Make sure to pass a `memberId` and not a `contactId` to identify the member. Any relationship between a member's `memberId` and `contactId` is coincidental.

---

## REST API

### Schema

```
 Method: setActivityCounters
 Description: Sets activity counters for a requested site member.  If the counter does not already exist, it will be created.  Counters are identified with a custom key, which must be unique.  > **Note**: Make sure to pass a `memberId` and not a `contactId` to identify the member. Any relationship between a member's `memberId` and `contactId` is coincidental.
 URL: https://www.wixapis.com/members/v1/activity-counters/{memberId}
 Method: PUT
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  counter
 Method parameters: 
   param name: counter | type: Counter   | required: true 
        - name: key | type: string | description: Counter key, unique within the given app.  
        - name: public | type: boolean | description: Whether this counter data is available to all. If `false`, the counter is only available to the data owner and counter owner.  
        - name: count | type: integer | description: Activity count.  
 Return type: SetActivityCountersResponse
  - name: activityCounter | type: ActivityCounter | description: Updated activity counter.  
     - name: memberId | type: string | description: Member GUID.  | validation: format GUID
     - name: appId | type: string | description: App GUID. When developing websites, if you set activity counter data using elevation, the action is assigned to the generic Wix code backend app: `151e476a-715e-ec33-db9a-a7ff4d51f70a`.  | validation: format GUID
     - name: counters | type: array<Counter> | description: Counters for this member.  
        - name: key | type: string | description: Counter key, unique within the given app.  
        - name: public | type: boolean | description: Whether this counter data is available to all. If `false`, the counter is only available to the data owner and counter owner.  
        - name: count | type: integer | description: Activity count.  
     - name: revision | type: string | description: Revision number, which increments by 1 each time the counter is updated. To prevent conflicting changes, the existing revision must be used when updating a counter.  | read-only: true | validation: format int64


```

### Examples

### Set Activity Counters
```curl
curl -X PUT \
  https://www.wixapis.com/members/v1/activity-counters/bc93bbe5-228e-4468-a9ac-ebc15f90427e \
  -H 'Content-Type: application/json;charset=UTF-8' \
  -H 'Authorization: <AUTH>' \
  -d '{
      "memberId": "bc93bbe5-228e-4468-a9ac-ebc15f90427e",
      "counter": {
          "key": "My custom key",
          "public": true,
          "count": 10
      }
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.activityCounters.activityCounters.setActivityCounters(memberId, counter)
 Description: Sets activity counters for a requested site member.  If the counter does not already exist, it will be created.  Counters are identified with a custom key, which must be unique.  > **Note**: Make sure to pass a `memberId` and not a `contactId` to identify the member. Any relationship between a member's `memberId` and `contactId` is coincidental.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  counter, memberId
 Method parameters: 
   param name: memberId | type: string | description: Member GUID whose counter will be set. | required: true | validation: format GUID
   param name: counter | type: Counter   | required: true 
        - name: key | type: string | description: Counter key, unique within the given app.  
        - name: public | type: boolean | description: Whether this counter data is available to all. If `false`, the counter is only available to the data owner and counter owner.  
        - name: count | type: integer | description: Activity count.  
 Return type: PROMISE<SetActivityCountersResponse>
  - name: activityCounter | type: ActivityCounter | description: Updated activity counter.  
     - name: memberId | type: string | description: Member GUID.  | validation: format GUID
     - name: appId | type: string | description: App GUID. When developing websites, if you set activity counter data using elevation, the action is assigned to the generic Wix code backend app: `151e476a-715e-ec33-db9a-a7ff4d51f70a`.  | validation: format GUID
     - name: counters | type: array<Counter> | description: Counters for this member.  
        - name: key | type: string | description: Counter key, unique within the given app.  
        - name: public | type: boolean | description: Whether this counter data is available to all. If `false`, the counter is only available to the data owner and counter owner.  
        - name: count | type: integer | description: Activity count.  
     - name: revision | type: string | description: Revision number, which increments by 1 each time the counter is updated. To prevent conflicting changes, the existing revision must be used when updating a counter.  | read-only: true | validation: format int64


```

### Examples

### setActivityCounters
```javascript
import { activityCounters } from '@wix/activity-counters';

async function setActivityCounters(memberId,counter) {
  const response = await activityCounters.setActivityCounters(memberId,counter);
};
```

### setActivityCounters (with elevated permissions)
```javascript
import { activityCounters } from '@wix/activity-counters';
import { auth } from '@wix/essentials';

async function mySetActivityCountersMethod(memberId,counter) {
  const elevatedSetActivityCounters = auth.elevate(activityCounters.setActivityCounters);
  const response = await elevatedSetActivityCounters(memberId,counter);
}
```

### setActivityCounters (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { activityCounters } from '@wix/activity-counters';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { activityCounters },
  // Include the auth strategy and host as relevant
});


async function setActivityCounters(memberId,counter) {
  const response = await myWixClient.activityCounters.setActivityCounters(memberId,counter);
};
```

---