As part of the instrumentation for the Reading Lists experiment T397532, we want to log the total number of articles that a user saves throughout the experiment.
After discussing this metrics with the Reader Experience team engineers & product analytics (meeting notes), we decided the most performant and stable way of logging this metrics would be by sending an eventLogging event whenever an API add/delete event occurs.
We discussed different options of how to send this data. Client-side, in browser, we don't have access to the users total number of saved articles, so instead, we opted to send this event from PHP in the Reading List extension. Experiment Lab PHP API.
User story
As a product team, we want to know how many articles users save during this experiment.
Requirements
Whenever someone clicks the bookmark icon, we want to log an event containing the total number of pages they have saved.
User flow
- A user is bucketed into the experiment
- They save or remove an article
- That user behaviour triggers an API call.
- When the API is called in the backend, we log an eventLogging event that contains the total number of saved articles.
- Article save or remove event (backend)
action: TBD
action_subtype: save_article_to_reading_list / remove_article_from_reading_list
action_source: reading_list_api
action_context: {article_count: <INT>}Acceptance criteria
Since this event will be sent from PHP, it will not be visible in the browser console. Instead, we have to inspect the eventlogging end-point to see if the event was sent.
- Verify the feasibility of this approach with a POC patch.
BDD
Feature: Backend instrumentation for total saved articles
Scenario: User saves an article
Given I am bucketed into the Reading List experiment
When I save an article (bookmark icon triggers API)
Then the backend API logs an EventLogging event
And the event includes action_subtype = save_article_to_reading_list
And action_context includes the updated article_count
Scenario: User removes an article
Given I am bucketed into the Reading List experiment
When I remove an article from my saved list
Then the backend API logs an EventLogging event
And the event includes action_subtype = remove_article_from_reading_list
And action_context includes the updated article_countTest Steps
Test Case 1: Save article logs event with total count
- Log in as a user bucketed into the Reading List experiment.
- Save an article using the bookmark icon.
- Inspect the network tab for a request to the EventLogging endpoint.
- AC1: An event is sent when the article is saved.
- AC2: The event includes action_subtype = save_article_to_reading_list.
- AC3: The event includes action_source = reading_list_api.
- AC4: The event includes action_context with article_count as an integer (updated total).
Test Case 2: Remove article logs event with total count
- While logged in, remove a previously saved article.
- Inspect the network tab for a request to the EventLogging endpoint.
- AC5: An event is sent when the article is removed.
- AC6: The event includes action_subtype = remove_article_from_reading_list.
- AC7: The event includes action_source = reading_list_api.
- AC8: The event includes action_context with article_count as an integer (updated total).
This task was created by Version 1.0.0 of the Reader Experience team task template using phabulous.
