-
Notifications
You must be signed in to change notification settings - Fork 33
Stats
Igor Balos edited this page Oct 29, 2018
·
1 revision
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);
client.getOutboundOverview().then(result => {
console.log(result.Sent);
console.log(result.BounceRate);
});
client.getSentCounts().then(result => {
console.log(result.Days[0].Sent);
console.log(result.Days[0].Date);
});
client.getBounceCounts().then(result => {
console.log(result.HardBounce);
console.log(result.Days);
console.log(result.Days[0].HardBounce);
});
client.getSpamComplaintsCounts().then(result => {
console.log(result);
});
client.getTrackedEmailCounts().then(result => {
console.log(result.Days[0].Date);
console.log(result.Days[0].Tracked);
console.log(result.Tracked);
});
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);
});
client.getEmailPlatformUsage().then(result => {
console.log(result.Days[0].Unknown);
});
client.getEmailClientUsage().then(result => {
console.log(result.Days[0].Date);
console.log(result.Days[0].Gmail);
console.log(result.Gmail);
});
client.getEmailReadTimes().then(result => {
console.log(result.Days[0].Date);
console.log(result.Days[0]);
});
client.getClickCounts().then(result => {
console.log(result.Clicks);
console.log(result.Days[0].Unique);
});
client.getClickBrowserUsage().then(result => {
console.log(result.Days[0].Chrome);
console.log(result.Chrome);
});
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);
});
For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.
- Overview
- Migration from older version
- Getting started
- Email sending
- Bounces
- Templates
- Templates Push
- Server
- Servers
- Message Streams
- Webhooks
- Messages
- Domains
- Sender Signatures
- Stats
- Trigger Inbound Rules
- Suppressions
- Data Removal
- Embedding images in emails
- Error Handling
- Handling Web Hooks
- Mocking requests
- Troubleshooting
- Known issues and how to resolve them