Ghost/ghost/email-analytics-service
Kevin Ansfield 7bbf644d0d Added email analytics service (#12393)
no issue

- added `EmailAnalyticsService`
  - `.fetchAll()` grabs and processes all available events
  - `.fetchLatest()` grabs and processes all events since the last seen event timestamp
  - `EventProcessor` passed event objects and updates `email_recipients` or `members` records depending on the event being analytics or list hygiene
    - always returns a `EventProcessingResult` instance so that progress can be tracked and merged across individual events, batches (pages of events), and total runs
    - adds email_id and member_id to the returned result where appropriate so that the stats aggregator can limit processing to data that has changed
    - sets `email_recipients.{delivered_at, opened_at, failed_at}` for analytics events
    - sets `members.subscribed = false` for permanent failure/unsubscribed/complained list hygiene events
  - `StatsAggregator` takes an `EventProcessingResult`-like object containing arrays of email ids and member ids on which to aggregate statistics.
  - jobs for `fetch-latest` and `fetch-all` ready for use with the JobsService
- added `initialiseRecurringJobs()` function to Ghost bootup procedure that schedules the email analytics "fetch latest" job to run every minute
2021-02-24 21:03:29 +00:00
..
lib Added email analytics service (#12393) 2021-02-24 21:03:29 +00:00
test Added empty email analytics packages 2021-02-24 21:03:29 +00:00
.eslintrc.js Added empty email analytics packages 2021-02-24 21:03:29 +00:00
index.js Added empty email analytics packages 2021-02-24 21:03:29 +00:00
LICENSE Added empty email analytics packages 2021-02-24 21:03:29 +00:00
package.json Added empty email analytics packages 2021-02-24 21:03:29 +00:00
README.md Added empty email analytics packages 2021-02-24 21:03:29 +00:00

Email Analytics Service

Install

npm install @tryghost/email-analytics-service --save

or

yarn add @tryghost/email-analytics-service

Usage

Develop

This is a mono repository, managed with lerna.

Follow the instructions for the top-level repo.

  1. git clone this repo & cd into it as usual
  2. Run yarn to install top-level dependencies.

Run

  • yarn dev

Test

  • yarn lint run just eslint
  • yarn test run lint and tests

Copyright & License

Copyright (c) 2021 Ghost Foundation - Released under the MIT license.