Actions and click tracking
Add buttons to a notification and find out which one the person clicked.
A notification can carry up to 2 action buttons. The browser reports every click, button and dismissal back to Push, so you can see what the person did with each attempt.
Adding actions#
Each action has an id, a title and an optional url. Ids must be unique within the notification. The full rules are in Message options.
⫻
request body
What a click does#
| The person | Browser opens | Push records |
|---|---|---|
| Clicks the notification | The notification's url, or nothing when it has none | clickedAt |
| Clicks an action | The action's url; without one, the notification's url; without that, nothing | clickedAt and actionClicked set to the action's id |
| Dismisses it | Nothing | closedAt |
- The notification closes on any click.
- Only the first click is kept: a later click does not change
clickedAtoractionClicked. - Only the first dismissal is kept in
closedAt.
How events reach Push#
Push's service worker in the person's browser sends each event to POST /v1/events, signed with a token that belongs to that browser and only works for its own attempts. Reporting is best effort: if the device is offline or the browser is closed at that moment, the event can be lost. A missing clickedAt does not prove that nobody saw the notification.
Where buttons appear#
url too, so the most important action is one click away everywhere. See Browser compatibility.Reading the events#
Each attempt in GET /v1/notifications/{id} carries the browser events:
⫻
curl
⫻
attempts[0]
clickedAt, actionClicked and closedAt are null until the browser reports them. What each field means is listed in Statuses.