Search.../

listStatistics( )

Developer Preview

Retrieves a list of statistics for up to 100 selected campaigns.

Description

For each campaign, you receive the total activity count for the campaign's landing page and email. For example, the total amount of times the landing page was opened, or the total amount of email recipients that clicked a link in an email.

Use List Campaigns to retrieve additional information for your campaigns. Use List Recipients to retrieve a list of recipients and their activities related to a selected campaign.

This function is not a universal function and runs only on the backend.

Admin Method

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

Syntax

function listStatistics(campaignIds: Array<string>): Promise<ListStatisticsResponse>

listStatistics Parameters

NAME
TYPE
DESCRIPTION
campaignIds
Array<
string
>

IDs of the campaigns to retrieve.

Max: 100 campaigns

Returns

Return Type:

Promise<
ListStatisticsResponse
>
NAME
TYPE
DESCRIPTION
statistics
Array<
CampaignStatisticsContainer
>

List of statistics.

Was this helpful?

Retrieves a list of statistics for up to 100 selected campaigns (dashboard page code)

Copy Code
1import { campaigns } from 'wix-email-marketing.v2';
2
3// Sample campaignIds = ['ea46013c-bbbf-4617-ad5d-9247bc4c0970', 'ea46013c-bb6f-4617-ad5d-9247bc4g5478', 'ea46013c-bf9f-4617-ad5d-9247bcg0837'];
4
5export async function listStatistics(campaignIds) {
6 try {
7 const results = await campaigns.listStatistics(campaignIds);
8
9 console.log("Success! Your statistics are listed.")
10 return results;
11 } catch (error) {
12 console.error(error);
13 }
14}
15
16/* Promise resolves to:
17 * {
18 * "statistics": [
19 * {
20 * "campaignId": "ea46013c-bbbf-4617-ad5d-9247bc4c0970",
21 * "landingPage": {
22 * "opened": 0,
23 * "clicked": 0
24 * },
25 * "email": {
26 * "delivered": 1,
27 * "opened": 1,
28 * "clicked": 0,
29 * "bounced": 0,
30 * "complained": 0,
31 * "notSent": 0
32 * },
33 * {
34 * "campaignId": "ea46013c-bb6f-4617-ad5d-9247bc4g5478",
35 * "landingPage": {
36 * "opened": 8,
37 * "clicked": 12
38 * },
39 * "email": {
40 * "delivered": 35,
41 * "opened": 22,
42 * "clicked": 15,
43 * "bounced": 0,
44 * "complained": 0,
45 * "notSent": 0
46 * },
47 * {
48 * "campaignId": "ea46013c-bf9f-4617-ad5d-9247bcg0837",
49 * "landingPage": {
50 * "opened": 10,
51 * "clicked": 10
52 * },
53 * "email": {
54 * "delivered": 55,
55 * "opened": 42,
56 * "clicked": 13,
57 * "bounced": 1,
58 * "complained": 0,
59 * "notSent": 0
60 * }
61 * }
62 * ]
63 * }
64 */
65
Retrieves a list of statistics for up to 100 selected campaigns (export from backend code)

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { campaigns } from 'wix-email-marketing.v2';
3
4// Sample campaignIds = ['ea46013c-bbbf-4617-ad5d-9247bc4c0970', 'ea46013c-bb6f-4617-ad5d-9247bc4g5478', 'ea46013c-bf9f-4617-ad5d-9247bcg0837'];
5
6export const listStatistics = webMethod(Permissions.Anyone, async (campaignIds) => {
7 try {
8 const results = await campaigns.listStatistics(campaignIds);
9
10 console.log("Success! Your statistics are listed.")
11 return results;
12 } catch (error) {
13 console.error(error);
14 }
15});
16
17/* Promise resolves to:
18 * {
19 * "statistics": [
20 * {
21 * "campaignId": "ea46013c-bbbf-4617-ad5d-9247bc4c0970",
22 * "landingPage": {
23 * "opened": 0,
24 * "clicked": 0
25 * },
26 * "email": {
27 * "delivered": 1,
28 * "opened": 1,
29 * "clicked": 0,
30 * "bounced": 0,
31 * "complained": 0,
32 * "notSent": 0
33 * },
34 * {
35 * "campaignId": "ea46013c-bb6f-4617-ad5d-9247bc4g5478",
36 * "landingPage": {
37 * "opened": 8,
38 * "clicked": 12
39 * },
40 * "email": {
41 * "delivered": 35,
42 * "opened": 22,
43 * "clicked": 15,
44 * "bounced": 0,
45 * "complained": 0,
46 * "notSent": 0
47 * },
48 * {
49 * "campaignId": "ea46013c-bf9f-4617-ad5d-9247bcg0837",
50 * "landingPage": {
51 * "opened": 10,
52 * "clicked": 10
53 * },
54 * "email": {
55 * "delivered": 55,
56 * "opened": 42,
57 * "clicked": 13,
58 * "bounced": 1,
59 * "complained": 0,
60 * "notSent": 0
61 * }
62 * }
63 * ]
64 * }
65 */
66