Email Tracking - PurposeOpen/Platform GitHub Wiki
The Purpose Platform tracks email activity (sent, opened, clicked) in parallel with tracking provided by Sendgrid. The Platform also tracks actions taken after a user has clicked on a link to an action page in an email.
Sends
When a blast email is sent, the Platform sends requests to Sendgrid in batches. A sent event for each email/user pair is recorded when the request is sent to Sendgrid. Sendgrid then sends the emails to users; sending may be throttled at Sendgrid.
Opens
A 1px x 1px gif is embedded in each HTML email sent by the Platform. When a user opens the email, if they allow images to be loaded, a request for the image will be sent to the movement site. The movement site serves the image and notifies the Platform of the open via API (:email_opened). The Porpoise gem (:index) provides this functionality on the movement site.
Clicks
When preparing to send a blast email, the Platform appends a tracking hash ('t' parameter) to all links in the email. The tracking hash is an encoded form of the email ID and user ID (email recipient).
When a user clicks on a link to the movement site with the tracking hash on it, the movement site detects the tracking hash and notifies (:track_email_click) the Platform via API (:email_clicked) of the tracking hash, the type of page, and the page ID.
If a link is clicked and an open has not been recorded yet, an open is recorded since a click implies an open.
Actions Taken
When a user signs an action page and they visited the page via an email link, the tracking hash will be in the URL they visit. When the form is submitted, the tracking parameter (‘t’) needs to be passed to the Platform API:
:do_take_action
:action_info_from
https://github.com/PurposeOpen/Platform/wiki/Take-Action
New Members
If a member clicks an email link that goes to an action page and they sign and are re-subscribed, then it will track that signature as both a ‘new member’ and ‘action taken'.
If you want email tracking to work with join forms on non-action pages, for example a homepage join, then the tracking hash ‘t’ parameter needs to be included in the request to this endpoint:
:create
https://github.com/PurposeOpen/Platform/wiki/Create-New-Member
Unsubscribes
Unsubscribe tracking uses the same mechanism as tracking actions taken from email clicks.
Spam and Bounces
There are endpoints on the Platform that receive spam and bounce events from Sendgrid:
:event_handler