Page MenuHomePhabricator

Verify search recommendations A/B test click tracking is working as expected
Closed, ResolvedPublic3 Estimated Story Points

Description

Follow up to T383358

Background

In T383358 we hit a few issues QAing that the instrumentation was working as expected due to configuration on the beta cluster.

User story

As a web team member I want to launch an A/B test that collects the information we need.

Requirements

  • We have configured the instrumentation to work correctly
  • We have run the QA steps in T383358

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 fired

Test Steps

Test Case 1: Verify event fires for search session initiation

  1. Open an incognito window and visit https://en.m.wikipedia.beta.wmflabs.org/w/index.php?title=T352930.
  2. Log in to a user account.
  3. Open the JavaScript console and execute:
mw.loader.using('mediawiki.api').then(function () {  
  new mw.Api().saveOption('eventlogging-display-console', '1');  
});
  1. Ensure the search bar is visible.
  2. Click on the empty search box.
  3. Verify that an event fires with:

• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: init
• Action Subtype: init_search_box

  1. AC1: Event fires when the empty search box appears.

Test Case 2: Verify event fires when user clicks on the empty search box

  1. Follow Test Case 1 steps until step 4.
  2. Click inside the search box.
  3. Verify that an event fires with:

• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: click
• Action Source: search_box

  1. AC2: Event fires when the user clicks on the empty search box.

Test Case 3: Verify event fires when empty-state recommendations appear

  1. Follow Test Case 1 steps until step 4.
  2. Ensure that the empty-state recommendations appear in the search box dropdown.
  3. Verify that an event fires with:

• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: show
• Action Subtype: show_empty_state_recommendation

  1. AC3: Event fires when empty-state recommendations appear.

Test Case 4: Verify event fires when user starts typing the first letter

  1. Follow Test Case 1 steps until step 4.
  2. Type a single letter in the search box.
  3. Verify that an event fires with:

• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: type
• Action Source: search_box

  1. AC4: Event fires when user types the first letter.

Test Case 5: Verify event fires when type-ahead recommendations appear

  1. Follow Test Case 4 steps until step 2.
  2. Ensure that type-ahead recommendations appear in the search box dropdown.
  3. Verify that an event fires with:

• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: show
• Action Subtype: show_autocomplete_recommendation

  1. AC5: Event fires when type-ahead recommendations appear.

Test Case 6: Verify event fires when user clicks on an empty-state recommendation

  1. Follow Test Case 3 steps until step 2.
  2. Click on one of the empty-state recommendations.
  3. Verify that an event fires with:

• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: click
• Action Source: empty_search_suggestion

  1. 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

  1. Follow Test Case 5 steps until step 2.
  2. Click on one of the type-ahead recommendations.
  3. Verify that an event fires with:

• Event Name: product_metrics.web_base.search_ab_test_clicks
• Action: click
• Action Source: autocomplete_search_suggestion

  1. AC7: Event fires when user clicks on a type-ahead recommendation.

Design

  • Add mockups and design requirements

Acceptance criteria

  • If any issues are discovered that block deploying A/B test, tasks are created, estimated and the sprint is revised to accomodate them.

Communication criteria - does this need an announcement or discussion?

  • Add communication criteria

Rollback plan

  • What is the rollback plan in production for this task if something goes wrong?

QA Results - Beta

This task was created by Version 1.2.0 of the Web team task template using phabulous

Event Timeline

Jdlrobson-WMF changed the task status from Open to In Progress.Jan 31 2025, 7:44 PM
Jdlrobson-WMF triaged this task as High priority.
Jdrewniak set the point value for this task to 3.Feb 3 2025, 6:38 PM

After talking with Metrics Platform, the issue is most likely that we're missing a unit property in addition to the rate property on the beta config.
I think that involved adding the unit lines to InitialiseSettings-labs.php#234

'product_metrics.web_base.search_ab_test_session_ticks' => [
	'sample' => [
			'rate' => 1,
			'unit' => 'session',
			],
		],
		'product_metrics.web_base.search_ab_test_clicks' => [
			'sample' => [
				'rate' => 1,
				'unit' => 'session',
			],
		],

Change #1117951 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[operations/mediawiki-config@master] Beta: Add missing 'unit' value to `search_ab_test_clicks` stream

https://gerrit.wikimedia.org/r/1117951

Change #1117951 merged by jenkins-bot:

[operations/mediawiki-config@master] Beta: Adjust config for Web search AB test

https://gerrit.wikimedia.org/r/1117951

I am now seeing events in the console with the preference enabled

mw.loader.using('mediawiki.api').then(function () {  
  new mw.Api().saveOption('eventlogging-display-console', '1');  
});

You should be unblocked now Edward!

Edtadros subscribed.

Status: ✅ PASS
Environment: Beta
OS: macOS
Browser: Chrome
Device: MS

Test Steps

Test Case 1: Verify event fires for search session initiation

  1. Open an incognito window and visit https://en.m.wikipedia.beta.wmflabs.org/w/index.php?title=T352930.
  2. Log in to a user account.
  3. Open the JavaScript console and execute:
mw.loader.using('mediawiki.api').then(function () {  
  new mw.Api().saveOption('eventlogging-display-console', '1');  
});
  1. Ensure the search bar is visible.
  2. Click on the empty search box.
  3. Verify that an event fires with:

• Event Name: mediawiki_web_ui_actions
• Action: init
• Action Subtype: init_search_box

  1. AC1: Event fires when the empty search box appears.
{
    "action": "init",
    "font": "1",
    "is_full_width": false,
    "is_page_preview_on": true,
    "is_pinned": false,
    "is_media_viewer_enabled": true,
    "is_dark_mode_prepared_by_os": true,
    "dark_mode_setting": "0",
    "is_dark_mode_on": false,
    "action_context": "stable,amc",
    "viewport_size_bucket": "1200px-2000px",
    "action_source": "ns=0",
    "is_temp": false,
    "$schema": "/analytics/mediawiki/product_metrics/web_ui_actions/1.0.2",
    "page": {
        "namespace_id": 0
    },
    "performer": {
        "is_logged_in": true,
        "session_id": "410ae17c0f591181a822",
        "pageview_id": "4cf1da6f01d80478b273",
        "edit_count_bucket": "5-99 edits",
        "groups": [
            "*",
            "user",
            "autoconfirmed"
        ],
        "is_bot": false
    },
    "mediawiki": {
        "skin": "minerva",
        "database": "enwiki"
    },
    "agent": {
        "client_platform": "mediawiki_js",
        "client_platform_family": "mobile_browser"
    },
    "sample": {
        "rate": 1,
        "unit": "session"
    },
    "dt": "2025-02-07T22:03:34.062Z",
    "meta": {
        "stream": "mediawiki.web_ui_actions",
        "domain": "en.wikipedia.beta.wmflabs.org"
    }
}

Test Case 2: Verify event fires when user clicks on the empty search box

  1. Follow Test Case 1 steps until step 4.
  2. Click inside the search box.
  3. Verify that an event fires with:

• Event Name: mediawiki_web_ui_actions
• Action: click
• Action Source: search_box

  1. AC2: Event fires when the user clicks on the empty search box.
{
    "action": "click",
    "funnel_name": "Search related articles",
    "funnel_entry_token": "410ae17c0f591181a822",
    "experiments": {
        "enrolled": [
            "RelatedArticles test experiment betacluster\t"
        ],
        "assigned": {
            "RelatedArticles test experiment betacluster\t": "experimentEnabled"
        }
    },
    "action_source": "search_box",
    "$schema": "/analytics/product_metrics/web/base/1.3.0",
    "mediawiki": {
        "site_content_language": "en",
        "skin": "minerva"
    },
    "performer": {
        "session_id": "410ae17c0f591181a822",
        "is_logged_in": true
    },
    "agent": {
        "client_platform": "mediawiki_js",
        "client_platform_family": "mobile_browser"
    },
    "sample": {
        "rate": 1,
        "unit": "session"
    },
    "dt": "2025-02-07T22:04:44.705Z",
    "meta": {
        "stream": "product_metrics.web_base.search_ab_test_clicks",
        "domain": "en.wikipedia.beta.wmflabs.org"
    }
}

Test Case 3: Verify event fires when empty-state recommendations appear

  1. Follow Test Case 1 steps until step 4.
  2. Ensure that the empty-state recommendations appear in the search box dropdown.
  3. Verify that an event fires with:

• Event Name: mediawiki_web_ui_actions
• Action: show
• Action Subtype: show_empty_state_recommendation

  1. AC3: Event fires when empty-state recommendations appear.
{
    "action": "show",
    "funnel_name": "Search related articles",
    "funnel_entry_token": "410ae17c0f591181a822",
    "experiments": {
        "enrolled": [
            "RelatedArticles test experiment betacluster\t"
        ],
        "assigned": {
            "RelatedArticles test experiment betacluster\t": "experimentEnabled"
        }
    },
    "action_subtype": "show_empty_state_recommendation",
    "$schema": "/analytics/product_metrics/web/base/1.3.0",
    "mediawiki": {
        "site_content_language": "en",
        "skin": "minerva"
    },
    "performer": {
        "session_id": "410ae17c0f591181a822",
        "is_logged_in": true
    },
    "agent": {
        "client_platform": "mediawiki_js",
        "client_platform_family": "mobile_browser"
    },
    "sample": {
        "rate": 1,
        "unit": "session"
    },
    "dt": "2025-02-07T22:04:44.702Z",
    "meta": {
        "stream": "product_metrics.web_base.search_ab_test_clicks",
        "domain": "en.wikipedia.beta.wmflabs.org"
    }
}

Test Case 4: Verify event fires when user starts typing the first letter

  1. Follow Test Case 1 steps until step 4.
  2. Type a single letter in the search box.
  3. Verify that an event fires with:

• Event Name: mediawiki_web_ui_actions
• Action: type
• Action Source: search_box

  1. AC4: Event fires when user types the first letter.
{
    "action": "type",
    "funnel_name": "Search related articles",
    "funnel_entry_token": "410ae17c0f591181a822",
    "experiments": {
        "enrolled": [
            "RelatedArticles test experiment betacluster\t"
        ],
        "assigned": {
            "RelatedArticles test experiment betacluster\t": "experimentEnabled"
        }
    },
    "action_source": "search_box",
    "$schema": "/analytics/product_metrics/web/base/1.3.0",
    "mediawiki": {
        "site_content_language": "en",
        "skin": "minerva"
    },
    "performer": {
        "session_id": "410ae17c0f591181a822",
        "is_logged_in": true
    },
    "agent": {
        "client_platform": "mediawiki_js",
        "client_platform_family": "mobile_browser"
    },
    "sample": {
        "rate": 1,
        "unit": "session"
    },
    "dt": "2025-02-07T22:06:26.839Z",
    "meta": {
        "stream": "product_metrics.web_base.search_ab_test_clicks",
        "domain": "en.wikipedia.beta.wmflabs.org"
    }
}

Test Case 5: Verify event fires when type-ahead recommendations appear

  1. Follow Test Case 4 steps until step 2.
  2. Ensure that type-ahead recommendations appear in the search box dropdown.
  3. Verify that an event fires with:

• Event Name: mediawiki_web_ui_actions
• Action: show
• Action Subtype: show_autocomplete_recommendation

  1. AC5: Event fires when type-ahead recommendations appear.
{
    "action": "show",
    "funnel_name": "Search related articles",
    "funnel_entry_token": "410ae17c0f591181a822",
    "experiments": {
        "enrolled": [
            "RelatedArticles test experiment betacluster\t"
        ],
        "assigned": {
            "RelatedArticles test experiment betacluster\t": "experimentEnabled"
        }
    },
    "action_subtype": "show_autocomplete_recommendation",
    "$schema": "/analytics/product_metrics/web/base/1.3.0",
    "mediawiki": {
        "site_content_language": "en",
        "skin": "minerva"
    },
    "performer": {
        "session_id": "410ae17c0f591181a822",
        "is_logged_in": true
    },
    "agent": {
        "client_platform": "mediawiki_js",
        "client_platform_family": "mobile_browser"
    },
    "sample": {
        "rate": 1,
        "unit": "session"
    },
    "dt": "2025-02-07T22:06:28.875Z",
    "meta": {
        "stream": "product_metrics.web_base.search_ab_test_clicks",
        "domain": "en.wikipedia.beta.wmflabs.org"
    }
}

Test Case 6: Verify event fires when user clicks on an empty-state recommendation

  1. Follow Test Case 3 steps until step 2.
  2. Click on one of the empty-state recommendations.
  3. Verify that an event fires with:

• Event Name: mediawiki_web_ui_actions
• Action: click
• Action Source: empty_search_suggestion

  1. AC6: Event fires when user clicks on an empty-state recommendation.
{
    "action": "click",
    "font": "1",
    "is_full_width": false,
    "is_page_preview_on": true,
    "is_pinned": false,
    "is_media_viewer_enabled": true,
    "is_dark_mode_prepared_by_os": true,
    "dark_mode_setting": "0",
    "is_dark_mode_on": false,
    "action_context": "stable,amc",
    "viewport_size_bucket": "1200px-2000px",
    "action_source": "relatedArticles.emptySearch",
    "is_temp": false,
    "$schema": "/analytics/mediawiki/product_metrics/web_ui_actions/1.0.2",
    "page": {
        "namespace_id": 0
    },
    "performer": {
        "is_logged_in": true,
        "session_id": "410ae17c0f591181a822",
        "pageview_id": "0e7d9cee4b578254b307",
        "edit_count_bucket": "5-99 edits",
        "groups": [
            "*",
            "user",
            "autoconfirmed"
        ],
        "is_bot": false
    },
    "mediawiki": {
        "skin": "minerva",
        "database": "enwiki"
    },
    "agent": {
        "client_platform": "mediawiki_js",
        "client_platform_family": "mobile_browser"
    },
    "sample": {
        "rate": 1,
        "unit": "session"
    },
    "dt": "2025-02-07T22:12:59.467Z",
    "meta": {
        "stream": "mediawiki.web_ui_actions",
        "domain": "en.wikipedia.beta.wmflabs.org"
    }
}

Test Case 7: Verify event fires when user clicks on a type-ahead recommendation

  1. Follow Test Case 5 steps until step 2.
  2. Click on one of the type-ahead recommendations.
  3. Verify that an event fires with:

• Event Name: mediawiki_web_ui_actions
• Action: click
• Action Source: autocomplete_search_suggestion

  1. AC7: Event fires when user clicks on a type-ahead recommendation.
{
    "action": "click",
    "funnel_name": "Search related articles",
    "funnel_entry_token": "410ae17c0f591181a822",
    "experiments": {
        "enrolled": [
            "RelatedArticles test experiment betacluster\t"
        ],
        "assigned": {
            "RelatedArticles test experiment betacluster\t": "experimentEnabled"
        }
    },
    "action_source": "autocomplete_search_suggestion",
    "$schema": "/analytics/product_metrics/web/base/1.3.0",
    "mediawiki": {
        "site_content_language": "en",
        "skin": "minerva"
    },
    "performer": {
        "session_id": "410ae17c0f591181a822",
        "is_logged_in": true
    },
    "agent": {
        "client_platform": "mediawiki_js",
        "client_platform_family": "mobile_browser"
    },
    "sample": {
        "rate": 1,
        "unit": "session"
    },
    "dt": "2025-02-08T01:42:33.757Z",
    "meta": {
        "stream": "product_metrics.web_base.search_ab_test_clicks",
        "domain": "en.wikipedia.beta.wmflabs.org"
    }
}
Jdlrobson-WMF updated the task description. (Show Details)