Stats - ActiveCampaign/postmark.js GitHub Wiki

You can retrieve many different statistics by API. Here are couple of examples on how statistics retrieval can be used.

For these API requests you will need to use a server API token. Once you obtain it, you will need to use server API client.

const serverToken = "xxxx-xxxxx-xxxx-xxxxx-xxxxxx"
let postmark = require("postmark")
let client = new postmark.ServerClient(serverToken);

Retrieve outbound statistics

client.getOutboundOverview().then(result => {
    console.log(result.Sent);
    console.log(result.BounceRate);
});

Retrieve sent email statistics

client.getSentCounts().then(result => {
   console.log(result.Days[0].Sent);
   console.log(result.Days[0].Date);
});

Retrieve bounced email statistics

client.getBounceCounts().then(result => {
    console.log(result.HardBounce);
    console.log(result.Days);
    console.log(result.Days[0].HardBounce);
});

Retrieve spam email statistics

client.getSpamComplaintsCounts().then(result => {
    console.log(result);
});

Retrieve clicked email statistics

client.getTrackedEmailCounts().then(result => {
    console.log(result.Days[0].Date);
    console.log(result.Days[0].Tracked);
    console.log(result.Tracked);
});

Retrieve opened email statistics

client.getEmailOpenCounts().then(result => {
    console.log(result.Days[0].Opens);
    console.log(result.Days[0].Unique);
    console.log(result.Days[0].Date);
    console.log(result.Opens);
});

Retrieve opened platforms email statistics

client.getEmailPlatformUsage().then(result => {
    console.log(result.Days[0].Unknown);
});

Retrieve email open clients statistics

client.getEmailClientUsage().then(result => {
    console.log(result.Days[0].Date);
    console.log(result.Days[0].Gmail);
    console.log(result.Gmail);
});

Retrieve email open read time statistics

client.getEmailReadTimes().then(result => {
    console.log(result.Days[0].Date);
    console.log(result.Days[0]);
});

Retrieve email click detailed statistics

client.getClickCounts().then(result => {
    console.log(result.Clicks);
    console.log(result.Days[0].Unique);
});

Retrieve email click browser usage statistics

client.getClickBrowserUsage().then(result => {
    console.log(result.Days[0].Chrome);
    console.log(result.Chrome);
});

Retrieve email click platform statistics

client.getClickPlatformUsage().then(result => {
    console.log(result.Days[0].Unknown);
    console.log(result.Unknown);
});

Retrieve email click location statistics.

client.getClickLocation().then(result => {
    console.log(result.Days[0].HTML);
    console.log(result.Text);
});