Background
As follow up to T382080, and after T383611 is completed, we need to finish the click tracking according to the spec: https://docs.google.com/spreadsheets/d/1tYYRsxICotHT_uAt0gfZckHNZBmqZTKuykeUEwQSCvs/edit?gid=0#gid=0
User story
- As the web team we want to understand how search recommendations impacts search sessions in general
Requirements
Click tracking is implemented for all the click tracking metrics in the spec document:
| Search sessions initiations | The empty search box appears | product_metrics.web_base.search_ab_test_clicks (TBD) action='init', action_subtype='init_search_box' | |
| Actions of clicking the empty search box | The users clicked the empty search box, indicating that those in experiment group would have seen the new empty-state suggestions. | product_metrics.web_base.search_ab_test_clicks (TBD) action='click', action_source='search_box' | |
| Impressions of the empty-state recommendations | The list of the empty-state recommendations appears | product_metrics.web_base.search_ab_test_clicks (TBD) action='show', action_subtype='show_empty_state_recommendation' | |
| Actions of entering the first letter | The users start typing the first letter, indicating that they have completed using the empty search recommendation product_metrics.web_base.search_ab_test_clicks | (TBD) action='type', action_source='search_box' | |
| Impressions of the type-ahead search recommendations | The list of the type-ahead recommendations appears | product_metrics.web_base.search_ab_test_clicks (TBD) action='show', action_subtype='show_autocomplete_recommendation' | |
| Action of clicking the empty-state recomendations | Clicks to one of the recommendations from the new empty-state suggestions | product_metrics.web_base.search_ab_test_clicks (TBD) action='click', action_source='empty_search_suggestion' | |
| Action of clicking the type-ahead search recomendations | Clicks to one of the search recommendations from the type-ahead search suggestions | product_metrics.web_base.search_ab_test_clicks (TBD) action='click', 'autocomplete_search_suggestion' | |
BDD
Feature: Search Recommendations Click Tracking
Scenario: Track search session initiation
Given a user is on a Wikimedia search page
When the empty search box appears
Then an event with action 'init' and action_subtype 'init_search_box' should be fired
Scenario: Track clicking on the empty search box
Given a user is on a Wikimedia search page
When the user clicks inside the empty search box
Then an event with action 'click' and action_source 'search_box' should be fired
Scenario: Track impressions of empty-state recommendations
Given a user is on a Wikimedia search page
When the list of empty-state recommendations appears
Then an event with action 'show' and action_subtype 'show_empty_state_recommendation' should be fired
Scenario: Track when user starts typing
Given a user is on a Wikimedia search page
When the user types the first letter into the search box
Then an event with action 'type' and action_source 'search_box' should be fired
Scenario: Track impressions of type-ahead search recommendations
Given a user is on a Wikimedia search page
When type-ahead recommendations appear
Then an event with action 'show' and action_subtype 'show_autocomplete_recommendation' should be fired
Scenario: Track clicks on empty-state recommendations
Given a user is on a Wikimedia search page
When the user clicks on an empty-state recommendation
Then an event with action 'click' and action_source 'empty_search_suggestion' should be fired
Scenario: Track clicks on type-ahead recommendations
Given a user is on a Wikimedia search page
When the user clicks on a type-ahead recommendation
Then an event with action 'click' and action_source 'autocomplete_search_suggestion' should be firedTest Steps
Test Case 1: Verify event fires for search session initiation
- Open an incognito window and visit https://en.m.wikipedia.beta.wmflabs.org/w/index.php?title=T352930.
- Log in to a user account.
- Open the JavaScript console and execute:
mw.loader.using('mediawiki.api').then(function () {
new mw.Api().saveOption('eventlogging-display-console', '1');
});- Ensure the search bar is visible.
- Click on the empty search box.
- Verify that an event fires with:
• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: init
• Action Subtype: init_search_box
- AC1: Event fires when the empty search box appears.
Test Case 2: Verify event fires when user clicks on the empty search box
- Follow Test Case 1 steps until step 4.
- Click inside the search box.
- Verify that an event fires with:
• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: click
• Action Source: search_box
- AC2: Event fires when the user clicks on the empty search box.
Test Case 3: Verify event fires when empty-state recommendations appear
- Follow Test Case 1 steps until step 4.
- Ensure that the empty-state recommendations appear in the search box dropdown.
- Verify that an event fires with:
• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: show
• Action Subtype: show_empty_state_recommendation
- AC3: Event fires when empty-state recommendations appear.
Test Case 4: Verify event fires when user starts typing the first letter
- Follow Test Case 1 steps until step 4.
- Type a single letter in the search box.
- Verify that an event fires with:
• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: type
• Action Source: search_box
- AC4: Event fires when user types the first letter.
Test Case 5: Verify event fires when type-ahead recommendations appear
- Follow Test Case 4 steps until step 2.
- Ensure that type-ahead recommendations appear in the search box dropdown.
- Verify that an event fires with:
• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: show
• Action Subtype: show_autocomplete_recommendation
- AC5: Event fires when type-ahead recommendations appear.
Test Case 6: Verify event fires when user clicks on an empty-state recommendation
- Follow Test Case 3 steps until step 2.
- Click on one of the empty-state recommendations.
- Verify that an event fires with:
• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: click
• Action Source: empty_search_suggestion
- AC6: Event fires when user clicks on an empty-state recommendation.
Test Case 7: Verify event fires when user clicks on a type-ahead recommendation
- Follow Test Case 5 steps until step 2.
- Click on one of the type-ahead recommendations.
- Verify that an event fires with:
• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: click
• Action Source: autocomplete_search_suggestion
- AC7: Event fires when user clicks on a type-ahead recommendation.
Acceptance criteria
- Spec is updated and QAed
