About the Activity Counters API

Activity counters track site members' activities across Wix apps.

The Activity Counters API allows you access Wix site members' public activity, and manage activity counters for an app.
When developing websites, if you set activity counter data using elevation, the action is assigned to the generic Wix code backend app.

See Integrations for activities that are counted from apps made by Wix.

Use cases

Before you begin

  • Each app manages its own set of counters for site members, and defines each counter as public or private.
  • You can access all public counters maintained by any Wix App.
  • Private counters can be accessed only by the counter owner and the relevant member.
  • 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.
  • Counters are created/set per member the first time they take the relevant action. If a counter isn't returned, the member may not have taken the relevant action yet.
  • Call Set Activity Counters both to create a counter and to update counter data.
  • There is currently no way to retrieve a list of all of your private and public activity counters at the app level.

Integrations

Activity Counters is currently integrated with the following apps made by Wix:

  • Wix Blog: Blog posts, comments, and likes.
  • Wix Forum: Forum posts, comments, likes, and views.
  • Wix Members Area: Followers in both directions (followed by / following).
  • Badges: Badges collected.
Did this help?

Sample Flows

This article shares some possible use cases your implementation could support, as well as an example flow that could support each use case. You're certainly not limited to these use cases, but they can be a helpful jumping off point as you plan your implementation.

Display "most influential member" data

You can display the "most influential members" data to a site page or dashboard page, based on how many likes and comments each member's posts get.

  1. Collect per-member reaction numbers for the Wix Blog and/or Wix Forum apps by calling Get Activity Counters.
  2. Display the returned values.

Display "high priority customer" data

Create a counter for customer activities you consider to be highest priority, for example purchases, and display "high priority customer" data in a dashboard page, displaying the site members with the highest numbers of high-priority actions.

  1. Plan the relevant counters and define an identifying key for each.
  2. Track the relevant activity per site member.
  3. When a member takes a relevant action, call Set Activity Counters with the relevant key. The counter will be created for each member the first time you call this method to set the activity. Note that if your counter is public, all apps, site visitors and members can access it.
  4. When a Wix user opens the relevant dashboard page, collect activity counters per member by calling Get Activity Counters.
  5. Display the returned values.
Did this help?

Activity Counter Object


Activity Counters service APIs

Properties
memberIdstringformat GUID

Member ID.


appIdstringformat GUID

App ID. 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.


countersArray <Counter>

Counters for this member.


revisionintegerRead-onlyformat int64
ActivityCounter
JSON
{ "memberId": "987110f7-5100-4beb-a948-de610fd18f00", "appId": "7eb67052-4478-416e-b444-eff7accf6cea", "counters": [ { "key": "This is key", "public": true, "count": 1 } ] }
Did this help?

PUT

Set Activity Counters


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.

Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage Activity Counters
Learn more about app permissions.
Endpoint
PUT
https://www.wixapis.com/members/v1/activity-counters/{memberId}

Path Params
memberIdstringRequired

Member ID whose counter will be set.

Body Params
counterCounterRequired

Counter data for this site member.

Response Object
activityCounterActivityCounter

Updated activity counter.

Set Activity Counters
Request
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 } }'
Response
JSON
{ "activityCounter": { "memberId": "bc93bbe5-228e-4468-a9ac-ebc15f90427e", "appId": "fb70a122-6276-4bbd-9cc6-ea9bc452b2a1", "counters": [ { "key": "This is my public key", "public": true, "count": 1 }, { "key": "My custom key", "public": true, "count": 10 } ] } }
Event TriggersThis method triggers the following events:
Did this help?

GET

Get Activity Counters


Retrieves activity counters for the specified site member, including all public counters and any private counters owned by the authenticated caller.

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.

Permissions
Manage Activity Counters
Read Activity Counters
Learn more about app permissions.
Endpoint
GET
https://www.wixapis.com/members/v1/activity-counters/{memberId}

Path Params
memberIdstringRequired

Member ID whose counters will be returned.

Response Object
activityCountersArray <ActivityCounter>

Activity counters.

Get Activity Counters
Request
cURL
curl -X GET \ https://www.wixapis.com/members/v1/activity-counters/987110f7-5100-4beb-a948-de610fd18f00 \ -H 'Authorization: <AUTH>' \
Response
JSON
{ "activityCounters": [ { "memberId": "987110f7-5100-4beb-a948-de610fd18f00", "appId": "7eb67052-4478-416e-b444-eff7accf6cea", "counters": [ { "key": "This is public key", "public": true, "count": 3 } ] }, { "memberId": "987110f7-5100-4beb-a948-de610fd18f00", "appId": "fb70a122-6276-4bbd-9cc6-ea9bc452b2a1", "counters": [ { "key": "This is private key", "public": false, "count": 10 }, { "key": "This is another public key", "public": true, "count": 10 } ] } ] }
Did this help?

POST

Query Activity Counters


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

Only counters that are marked as public are returned.

Supported fields for filtering:

  • memberId

Supported operations:

Comparison:

  • $eq
  • $ne
  • $in

Logical:

  • $and
  • $not
  • $or
Permissions
Manage Activity Counters
Read Activity Counters
Learn more about app permissions.
Endpoint
POST
https://www.wixapis.com/members/v1/activity-counters/query

Body Params
queryQuery

Query options.

Response Object
activityCountersArray <ActivityCounter>

Retrieved activity counters.


metadataMetadata

Paging metadata.

Retrieving counters with member id

Request
cURL
curl -X POST \ https://www.wixapis.com/members/v1/activity-counters/query \ -H 'Authorization: <AUTH>' \ -d '{ "query": { "filter": { "memberId": "987110f7-5100-4beb-a948-de610fd18f00" } } }'
Response
JSON
{ "activityCounters": [ { "memberId": "987110f7-5100-4beb-a948-de610fd18f00", "appId": "7eb67052-4478-416e-b444-eff7accf6cea", "counters": [ { "key": "This is public key", "public": true, "count": 3 } ] }, { "memberId": "987110f7-5100-4beb-a948-de610fd18f00", "appId": "fb70a122-6276-4bbd-9cc6-ea9bc452b2a1", "counters": [ { "key": "This is another public key", "public": true, "count": 10 } ] } ], "metadata": { "count": 2, "offset": 0, "total": 2 } }
Did this help?

Activity Counter Updated


Triggered when a member's activity counter is updated.

Permissions
Manage Activity Counters
Read Activity Counters
Learn more about app permissions.
Event BodyEvent Body Event data is received as a JSON Web Token (JWT). It may be delayed. Be sure to verify the data was sent by Wix.
Event Data
idstring

Unique event ID. Allows clients to ignore duplicate webhooks.


entityFqdnstring

Fully qualified domain name of the entity associated with the event. Expected wix.members.v1.activity_counter.


slugstring

Event name. Expected updated.


entityIdstring

ID of the entity associated with the event.


eventTimestringformat date-time

Event timestamp.


triggeredByAnonymizeRequestboolean

Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).


originatedFromstring

If present, indicates the action that triggered the event.


updatedEventUpdatedEvent

Event information.

Event Body

The data payload will include the following as an encoded JWT:

JSON
{ "data": { "eventType": "wix.members.v1.activity_counter_updated", "instanceId": "<app-instance-id>", "data": "<stringified-JSON>", // The identity field is sent as a stringified JSON "identity": { "identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP "anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR "memberId": "<memberId>", // in case of MEMBER "wixUserId": "<wixUserId>", // in case of WIX_USER "appId": "<appId>" // in case of APP } } }

ActivityCounterUpdated
JSON
{ "id": "4916088b-3bde-4666-826b-2f72e239d58c", "entityFqdn": "wix.members.v1.activitycounters", "slug": "updated", "entityId": "987110f7-5100-4beb-a948-de610fd18f00", "updatedEvent": { "currentEntity": { "memberId": "987110f7-5100-4beb-a948-de610fd18f00", "appId": "7eb67052-4478-416e-b444-eff7accf6cea", "counters": [ { "key": "This is key", "public": true, "count": 1 } ] } }, "eventTime": "2021-09-16T14:09:25.585986Z", "triggeredByAnonymizeRequest": false }
Did this help?