Skip to content

feat(recherche): mise en place A/B Testing sur les labels pour les contributions.#7243

Open
m-maillot wants to merge 2 commits intodevfrom
feat/ab-testing-label
Open

feat(recherche): mise en place A/B Testing sur les labels pour les contributions.#7243
m-maillot wants to merge 2 commits intodevfrom
feat/ab-testing-label

Conversation

@m-maillot
Copy link
Copy Markdown
Contributor

closes #7214

@m-maillot m-maillot requested a review from maxgfr April 21, 2026 09:05
@revu-bot revu-bot Bot requested a review from revu-bot April 21, 2026 09:05
@m-maillot m-maillot temporarily deployed to build-preproduction April 21, 2026 09:05 — with GitHub Actions Inactive
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Apr 21, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​socialgouv/​matomo-next@​1.11.0 ⏵ 1.13.19310010087 -4100

View full report

Copy link
Copy Markdown
Collaborator

@revu-bot revu-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary: A/B Testing for Contribution Labels in Search

This PR migrates A/B testing from a custom hand-rolled implementation (initABTesting.ts, useABTestVariant.ts) to the built-in A/B testing support in @socialgouv/matomo-next@1.13.1. The overall direction is positive — removing ~170 lines of custom code in favor of a library-maintained solution.

Key Changes

  • Upgrades @socialgouv/matomo-next from ^1.11.0 to ^1.13.1
  • Removes custom initABTesting.ts and useABTestVariant.ts
  • Passes abTests: AB_TESTS directly to trackAppRouter()
  • Defines a LabelCardSearch A/B test with 5 variations for contribution labels
  • Applies the variant in SearchCard and SearchResultCard

Issues Found

File Lines Severity Issue
abTests.ts 18–37 IMPORTANT percentage: 100 means all visitors are enrolled — no control group
utils.ts 39–54 IMPORTANT ORIGINAL variant falls through to default label — silent mismatch
SearchPageClient.test.tsx 32–34 IMPORTANT Mock returns wrong shape for useABTestVariant
abTests.ts 18 MINOR Test name "LabelCardSearch" is a magic string duplicated across files
MatomoAnalytics.tsx 32 MINOR SITE_URL import removed but was previously used — verify no regression

Comment thread packages/code-du-travail-frontend/src/modules/config/abTests.ts
Comment thread packages/code-du-travail-frontend/src/modules/config/abTests.ts
Comment thread packages/code-du-travail-frontend/src/modules/config/abTests.ts
Copy link
Copy Markdown
Member

@maxgfr maxgfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trop bien 🤩🤩🤩🤩🤩🤩

T'en penses quoi de l'approche ? 👀

@m-maillot
Copy link
Copy Markdown
Contributor Author

Trop bien 🤩🤩🤩🤩🤩🤩

T'en penses quoi de l'approche ? 👀

Super simple et efficace, le top 👍 Ca a été un jeu d'enfant à mettre en place.

@m-maillot m-maillot force-pushed the feat/ab-testing-label branch from a9f532b to 3d2674c Compare April 22, 2026 12:07
@m-maillot m-maillot temporarily deployed to build-review-auto April 22, 2026 12:07 — with GitHub Actions Inactive
@m-maillot m-maillot temporarily deployed to build-preproduction April 22, 2026 12:07 — with GitHub Actions Inactive
@m-maillot m-maillot temporarily deployed to build-review-auto April 22, 2026 14:20 — with GitHub Actions Inactive
@m-maillot m-maillot temporarily deployed to build-preproduction April 22, 2026 14:20 — with GitHub Actions Inactive
@m-maillot m-maillot force-pushed the feat/ab-testing-label branch from bd8c8ff to dd6ee08 Compare April 22, 2026 14:45
@m-maillot m-maillot temporarily deployed to build-review-auto April 22, 2026 14:45 — with GitHub Actions Inactive
@m-maillot m-maillot deployed to build-preproduction April 22, 2026 14:45 — with GitHub Actions Active
@sonarqubecloud
Copy link
Copy Markdown

@tokenbureau
Copy link
Copy Markdown

tokenbureau Bot commented Apr 22, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modifier le nom des labels dans la recherche

3 participants