Skip to content

feat: use strapi feature flags instead of posthog (JUM-844)#2833

Merged
mmioana merged 8 commits into
developfrom
feature/jum-844-switch-feature-flag-logic-from-posthog-to-strapi
May 5, 2026
Merged

feat: use strapi feature flags instead of posthog (JUM-844)#2833
mmioana merged 8 commits into
developfrom
feature/jum-844-switch-feature-flag-logic-from-posthog-to-strapi

Conversation

@mmioana
Copy link
Copy Markdown
Contributor

@mmioana mmioana commented Apr 28, 2026

Which Jira task belongs to this PR?

Contributes to JUM-844

Sister PRs
https://github.com/jumperexchange/strapi-cms/pull/106
https://github.com/jumperexchange/jumper-backend/pull/867

Why did I implement it this way?

Checklist before requesting a review

  • I have performed a self-review of my code
  • This pull request is as small as possible and only tackles one problem
  • I have added tests that cover the functionality / test the bug
  • If this changed the API, I have updated the documentation
  • I have provided QA instructions for the feature / fix implemented in this PR (if applicable)
  • I have provided instructions for any environment / deployment changes that this PR needs when merged

Summary by CodeRabbit

  • New Features

    • Feature-flag bootstrap now runs earlier during app startup.
    • New client hooks expose unified feature-flag data.
  • Improvements

    • Event and transaction tracking now include evaluated feature-flag variants and improved delivery/error handling.
    • Tracking utilities consolidated and exposed as shared tracking entry points.
  • Changes

    • Widgets no longer derive A/B variants from the connected wallet address (tracking payloads adjusted).

@mmioana mmioana self-assigned this Apr 28, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
jumper-exchange Ready Ready Preview, Comment May 5, 2026 11:51am
jumper-exchange-storybook Ready Ready Preview, Comment May 5, 2026 11:51am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 201c3ddd-4878-4e04-a0ab-e47f16d462d1

📥 Commits

Reviewing files that changed from the base of the PR and between 4cc1d02 and 44f8894.

📒 Files selected for processing (16)
  • src/app/[lng]/layout.tsx
  • src/app/lib/getPosthogFeatureFlag.ts
  • src/components/FeatureFlagsBootstrap/FeatureFlagsBootstrap.tsx
  • src/components/Widgets/Widgets.tsx
  • src/const/abi/jumperApiUrls.ts
  • src/const/urls.ts
  • src/hooks/useABTest.ts
  • src/hooks/useFeatureFlags.ts
  • src/hooks/useJumperTracking.ts
  • src/hooks/userTracking/useEarnTracking.ts
  • src/hooks/userTracking/useMissionTracking.ts
  • src/hooks/userTracking/useUserTracking.ts
  • src/providers/WidgetTrackingProvider.tsx
  • src/types/jumper-backend.ts
  • src/types/userTracking.ts
  • src/utils/tracking/jumperTracking.ts
💤 Files with no reviewable changes (4)
  • src/app/lib/getPosthogFeatureFlag.ts
  • src/const/abi/jumperApiUrls.ts
  • src/components/Widgets/Widgets.tsx
  • src/hooks/useJumperTracking.ts
✅ Files skipped from review due to trivial changes (8)
  • src/hooks/userTracking/useMissionTracking.ts
  • src/components/FeatureFlagsBootstrap/FeatureFlagsBootstrap.tsx
  • src/types/userTracking.ts
  • src/providers/WidgetTrackingProvider.tsx
  • src/hooks/useFeatureFlags.ts
  • src/const/urls.ts
  • src/utils/tracking/jumperTracking.ts
  • src/types/jumper-backend.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/hooks/userTracking/useEarnTracking.ts
  • src/hooks/useABTest.ts
  • src/hooks/userTracking/useUserTracking.ts

Walkthrough

Root layout now boots feature-flag evaluation by rendering a new client component. Feature-flag fetching is reworked into hooks and API DTOs; legacy PostHog helper and a monolithic jumper tracking hook were removed and replaced by a tracking utility with direct callers wired to the new flow.

Changes

Feature flags, tracking wiring, and API types

Layer / File(s) Summary
Root mount
src/app/[lng]/layout.tsx
Renders FeatureFlagsBootstrap inside the top-level Suspense after ReferrerCapture.
Bootstrap component
src/components/FeatureFlagsBootstrap/FeatureFlagsBootstrap.tsx
Adds client component that calls useFeatureFlags() during render and returns null.
DistinctId & feature flags hook
src/hooks/useFeatureFlags.ts
Adds useFeatureFlagsDistinctId (returns `account?.address
AB-test hook update
src/hooks/useABTest.ts
Refactors to use useFeatureFlags() (address parameter optional), maps variant to `string
Legacy helper removal
src/app/lib/getPosthogFeatureFlag.ts
Removes exported getPosthogFeatureFlag and its result type.
Jumper tracking utility
src/utils/tracking/jumperTracking.ts
Adds JumperEventData, JumperDataTrackTransactionProps, and trackJumperEvent / trackJumperTransaction which POST to backend endpoints and report errors to Sentry.
Remove old tracking hook
src/hooks/useJumperTracking.ts
Deletes prior useJumperTracking hook and its types.
User-tracking wiring
src/hooks/userTracking/useUserTracking.ts
Rewires to call trackJumperEvent/trackJumperTransaction, adds buildTransactionPayload, memoized sessionContext, and derives abTestVariants from useFeatureFlags.
Widget changes
src/components/Widgets/Widgets.tsx
Removes useAccount/useABTest trade-display initialization and stops injecting abTestVariants into WidgetTrackingProvider props.
Type & endpoint updates
src/types/jumper-backend.ts
Removes PosthogFeatureFlag; adds FeatureFlagResponseDto (key, name?, `variant: string
URL constants
src/const/abi/jumperApiUrls.ts, src/const/urls.ts
Removes old hard-coded analytics path constants and adds JumperBackendApiPaths enum with /users/events and /wallets/transactions.
Type import adjustments
src/hooks/userTracking/*, src/providers/WidgetTrackingProvider.tsx, src/types/userTracking.ts
Updates imports to reference new jumperTracking types and functions.

Sequence Diagram(s)

sequenceDiagram
    participant Root as RootLayout
    participant FFBoot as FeatureFlagsBootstrap
    participant Hook as useFeatureFlags
    participant API as Backend (/v1/feature-flags)
    participant Tracker as trackJumperEvent/Transaction
    participant Jumper as Jumper Backend (/users/events, /wallets/transactions)

    Root->>FFBoot: render FeatureFlagsBootstrap
    FFBoot->>Hook: call useFeatureFlags()
    Hook->>API: GET /v1/feature-flags?distinctId=...
    API-->>Hook: FeatureFlagResponseDto[] (cached)
    Hook-->>FFBoot: flags available
    User->>Tracker: trackEvent / trackTransaction (includes abTestVariants)
    Tracker->>Jumper: POST tracking payload
    Jumper-->>Tracker: response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • laurentsenta
  • chmanie

"I hopped through branches, twitching whiskers bright,
flags in a row, all set to light.
Hooks woke early, trackers tuned,
payloads tidy, endpoints pruned.
A carrot patch—code sleeps well tonight." 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: migrating feature flag logic from PostHog to Strapi, which aligns with the substantial refactoring across the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/jum-844-switch-feature-flag-logic-from-posthog-to-strapi

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

✅ All snapshot tests passed

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/hooks/useABTest.ts (1)

13-16: Remove or deprecate the unused address parameter.

address is still part of the public hook signature but no longer influences flag resolution, which can confuse callers.

♻️ Proposed cleanup
 export const useABTest = ({
   feature,
 }: {
   feature: AbTestName;
-  address?: string;
 }): UseABTestProps => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/hooks/useABTest.ts` around lines 13 - 16, The exported hook signature
useABTest currently accepts an unused address parameter (typed in
UseABTestProps) which should be removed or marked deprecated to avoid confusion;
update the function declaration and the UseABTestProps type to drop the address
field (or add a deprecation comment/JSdoc if compatibility required),
remove/address any internal references to address in useABTest and ensure all
call sites that pass address are updated to stop passing it or to use the new
API; also update exported types (AbTestName remains) and run/typecheck to catch
remaining usages.
src/types/jumper-backend.ts (1)

583-585: Tighten abTestVariants DTO shape for safer payload contracts.

Using object here loses useful type guarantees for tracking payload construction.

♻️ Proposed type tightening
   abtests?: object;
-  abTestVariants?: object;
+  abTestVariants?: Record<string, string | boolean>;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/types/jumper-backend.ts` around lines 583 - 585, The DTO uses loose type
object for abTestVariants (and abtests) which loses compile-time guarantees;
replace abTestVariants?: object with a tightened shape such as a named interface
or mapped type (e.g., AbTestVariantsDTO or Record<string,
string|number|boolean|unknown>) that models variant keys and values, add the
corresponding type definition (e.g., interface AbTestVariantsDTO { [testKey:
string]: string } or more precise fields as needed), and update the property
signature (abTestVariants?: AbTestVariantsDTO) so consumers and serializers have
a safer contract; do the same for abtests if it should be tightened.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/hooks/useFeatureFlags.ts`:
- Around line 25-26: The hook useFeatureFlags is building a URL to fetch feature
flags using `${backendUrl}/feature-flags?...` which hits the wrong endpoint;
update the URL construction (the `url` constant) to point to the versioned API
path `/v1/feature-flags` (e.g.
`${backendUrl}/v1/feature-flags?distinctId=${encodeURIComponent(distinctId)}`)
so the fetch call (the `fetch(url)` invocation) hits the correct backend route;
ensure no other callers in this file still reference the non-versioned path.

In `@src/types/jumper-backend.ts`:
- Around line 1014-1019: FeatureFlagResponseDto currently types variant as
object which is too broad; change the variant type to a scalar union (e.g.,
string | number | boolean) so callers no longer need unsafe casts and the
contract matches current A/B usage; update the OpenAPI source/schema for
FeatureFlagResponseDto.variant so regenerated types persist, and run/adjust any
code that assumes object to use the new scalar type (identify usages by
referencing FeatureFlagResponseDto and variant).

---

Nitpick comments:
In `@src/hooks/useABTest.ts`:
- Around line 13-16: The exported hook signature useABTest currently accepts an
unused address parameter (typed in UseABTestProps) which should be removed or
marked deprecated to avoid confusion; update the function declaration and the
UseABTestProps type to drop the address field (or add a deprecation
comment/JSdoc if compatibility required), remove/address any internal references
to address in useABTest and ensure all call sites that pass address are updated
to stop passing it or to use the new API; also update exported types (AbTestName
remains) and run/typecheck to catch remaining usages.

In `@src/types/jumper-backend.ts`:
- Around line 583-585: The DTO uses loose type object for abTestVariants (and
abtests) which loses compile-time guarantees; replace abTestVariants?: object
with a tightened shape such as a named interface or mapped type (e.g.,
AbTestVariantsDTO or Record<string, string|number|boolean|unknown>) that models
variant keys and values, add the corresponding type definition (e.g., interface
AbTestVariantsDTO { [testKey: string]: string } or more precise fields as
needed), and update the property signature (abTestVariants?: AbTestVariantsDTO)
so consumers and serializers have a safer contract; do the same for abtests if
it should be tightened.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9c8a7ecc-eda5-405b-b8b4-aee936af769c

📥 Commits

Reviewing files that changed from the base of the PR and between d66ea2e and 76ceca6.

📒 Files selected for processing (9)
  • src/app/[lng]/layout.tsx
  • src/app/lib/getPosthogFeatureFlag.ts
  • src/components/FeatureFlagsBootstrap/FeatureFlagsBootstrap.tsx
  • src/components/Widgets/Widgets.tsx
  • src/hooks/useABTest.ts
  • src/hooks/useFeatureFlags.ts
  • src/hooks/useJumperTracking.ts
  • src/hooks/userTracking/useUserTracking.ts
  • src/types/jumper-backend.ts
💤 Files with no reviewable changes (2)
  • src/components/Widgets/Widgets.tsx
  • src/app/lib/getPosthogFeatureFlag.ts

Comment thread src/hooks/useFeatureFlags.ts Outdated
Comment thread src/types/jumper-backend.ts
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Playwright test results

passed  51 passed
flaky  5 flaky
skipped  1 skipped

Details

stats  57 tests across 11 suites
duration  6 minutes, 31 seconds
commit  44f8894

Flaky tests

chromium › mainMenu.spec.ts › Main Menu flows › Should be able to open mission page and then open the mission (Qase ID: 9)
chromium › mainMenu.spec.ts › Main Menu flows › Should open Language section inside menu (Qase ID: 14)
chromium › mainMenu.spec.ts › Profile and Leaderboard navigation with wallet › Should open the Jumper Profile page and then open the leaderboard page (Qase ID: 10)
chromium › portfolioPage.spec.ts › Portfolio page › Verify elements and filters on portfolio page › verify that deposit and withdraw buttons are visible on DeFI positions tab
chromium › settings.spec.ts › Settings menu [Viewport: Mobile] › Should verify all settings menu functionality (Qase ID: 7)

Skipped tests

chromium › themeManipulation.spec.ts › Switch between dark and light theme and check the background color › Partner theme should appear in theme menu and apply background color (Qase ID: 49)

📋 View Detailed Qase Report

@mmioana mmioana marked this pull request as draft April 29, 2026 06:49
@mmioana mmioana marked this pull request as draft April 29, 2026 06:49
Comment thread src/components/FeatureFlagsBootstrap/FeatureFlagsBootstrap.tsx
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/utils/tracking/jumperTracking.ts (1)

84-116: Treat tracking failures as best-effort, not error-reporting signals.

These POSTs are expected to fail occasionally during navigation, offline states, or ad-blocking. Sending every failure to Sentry will create noisy telemetry and can obscure real regressions.

Consider keepalive/sendBeacon for reliability and limiting Sentry to unexpected failures.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/tracking/jumperTracking.ts` around lines 84 - 116, The track
function treats every fetch failure as an error and reports to Sentry; change it
to be best-effort: use navigator.sendBeacon for POSTs when available (falling
back to fetch with { keepalive: true }) from track (used by trackJumperEvent /
trackJumperTransaction), and avoid calling captureException for expected
transient failures (offline, aborted, ad-blockers). Specifically, modify track
to: 1) try navigator.sendBeacon(`${backendUrl}${path}`, JSON.stringify(data))
and return when successful; 2) otherwise use fetch(url, { method: 'POST',
headers, body, keepalive: true }) and only call captureException when the
failure is clearly non-transient (e.g., response.ok === false with a real status
code or an error that is not a TypeError/network-only failure); and 3)
short-circuit and do nothing (no Sentry) when navigator.onLine === false or the
thrown error is a typical network/abort error.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/hooks/useFeatureFlags.ts`:
- Around line 8-12: useFeatureFlagsDistinctId accesses account.address directly
which can be undefined during initial render; change the access to use optional
chaining (account?.address) so the function returns account?.address || fp.
Update the reference in the useFeatureFlagsDistinctId function where
useAccount() and useFpStore(...) are used to guard against missing account data.

---

Nitpick comments:
In `@src/utils/tracking/jumperTracking.ts`:
- Around line 84-116: The track function treats every fetch failure as an error
and reports to Sentry; change it to be best-effort: use navigator.sendBeacon for
POSTs when available (falling back to fetch with { keepalive: true }) from track
(used by trackJumperEvent / trackJumperTransaction), and avoid calling
captureException for expected transient failures (offline, aborted,
ad-blockers). Specifically, modify track to: 1) try
navigator.sendBeacon(`${backendUrl}${path}`, JSON.stringify(data)) and return
when successful; 2) otherwise use fetch(url, { method: 'POST', headers, body,
keepalive: true }) and only call captureException when the failure is clearly
non-transient (e.g., response.ok === false with a real status code or an error
that is not a TypeError/network-only failure); and 3) short-circuit and do
nothing (no Sentry) when navigator.onLine === false or the thrown error is a
typical network/abort error.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a0be2cea-8634-42ba-ad2f-4631fb2349ff

📥 Commits

Reviewing files that changed from the base of the PR and between 76ceca6 and 5e95421.

📒 Files selected for processing (11)
  • src/const/abi/jumperApiUrls.ts
  • src/const/urls.ts
  • src/hooks/useFeatureFlags.ts
  • src/hooks/useJumperTracking.ts
  • src/hooks/userTracking/useEarnTracking.ts
  • src/hooks/userTracking/useMissionTracking.ts
  • src/hooks/userTracking/useUserTracking.ts
  • src/providers/WidgetTrackingProvider.tsx
  • src/types/jumper-backend.ts
  • src/types/userTracking.ts
  • src/utils/tracking/jumperTracking.ts
💤 Files with no reviewable changes (2)
  • src/const/abi/jumperApiUrls.ts
  • src/hooks/useJumperTracking.ts
✅ Files skipped from review due to trivial changes (3)
  • src/providers/WidgetTrackingProvider.tsx
  • src/hooks/userTracking/useMissionTracking.ts
  • src/types/userTracking.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/hooks/userTracking/useUserTracking.ts
  • src/types/jumper-backend.ts

Comment thread src/hooks/useFeatureFlags.ts
@mmioana mmioana force-pushed the feature/jum-844-switch-feature-flag-logic-from-posthog-to-strapi branch from 5e95421 to 057c3c9 Compare May 4, 2026 11:55
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/hooks/userTracking/useUserTracking.ts`:
- Around line 219-230: The call to trackJumperTransaction in useUserTracking.ts
lacks error handling and can produce unhandled rejections; wrap the entire block
that checks disableTrackingTool?.includes(EventTrackingTool.JumperTracking) and
calls trackJumperTransaction in a try/catch, mirroring how
trackEvent/trackJumperEvent is handled, and on catch log the error (e.g., using
the same logger used elsewhere) without rethrowing so failures are swallowed
safely; ensure you still await trackJumperTransaction and preserve building
payload via buildTransactionPayload, getFeatureFlagVariants and the
abTestVariants merge.
- Around line 79-120: buildTransactionPayload currently calls Number(...) on
potentially undefined fields which yields NaN; update numeric conversions to
provide safe fallbacks so analytics don't get corrupted — for each numeric
property in buildTransactionPayload (fromAmount, fromAmountUSD, gasCostUSD,
toAmount, toAmountMin, toAmountUSD) replace
Number(data[TrackingEventParameter.X]) with a safe conversion that defaults to 0
when the source is undefined (e.g., use Number(data[... ] ?? 0) or an equivalent
check) and keep all other fields unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d6c5a2a0-65ea-4665-a242-54aee85689c9

📥 Commits

Reviewing files that changed from the base of the PR and between 5e95421 and 057c3c9.

📒 Files selected for processing (16)
  • src/app/[lng]/layout.tsx
  • src/app/lib/getPosthogFeatureFlag.ts
  • src/components/FeatureFlagsBootstrap/FeatureFlagsBootstrap.tsx
  • src/components/Widgets/Widgets.tsx
  • src/const/abi/jumperApiUrls.ts
  • src/const/urls.ts
  • src/hooks/useABTest.ts
  • src/hooks/useFeatureFlags.ts
  • src/hooks/useJumperTracking.ts
  • src/hooks/userTracking/useEarnTracking.ts
  • src/hooks/userTracking/useMissionTracking.ts
  • src/hooks/userTracking/useUserTracking.ts
  • src/providers/WidgetTrackingProvider.tsx
  • src/types/jumper-backend.ts
  • src/types/userTracking.ts
  • src/utils/tracking/jumperTracking.ts
💤 Files with no reviewable changes (4)
  • src/const/abi/jumperApiUrls.ts
  • src/hooks/useJumperTracking.ts
  • src/components/Widgets/Widgets.tsx
  • src/app/lib/getPosthogFeatureFlag.ts
✅ Files skipped from review due to trivial changes (7)
  • src/components/FeatureFlagsBootstrap/FeatureFlagsBootstrap.tsx
  • src/providers/WidgetTrackingProvider.tsx
  • src/types/userTracking.ts
  • src/const/urls.ts
  • src/hooks/userTracking/useMissionTracking.ts
  • src/hooks/useABTest.ts
  • src/utils/tracking/jumperTracking.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/hooks/userTracking/useEarnTracking.ts
  • src/hooks/useFeatureFlags.ts
  • src/types/jumper-backend.ts

Comment thread src/hooks/userTracking/useUserTracking.ts
Comment thread src/hooks/userTracking/useUserTracking.ts
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/hooks/userTracking/useUserTracking.ts (1)

216-237: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use the resolved transaction action for every tracking sink.

dataAction only feeds Jumper right now. If data[TrackingEventParameter.Action] differs from the action prop, GA/Addressable and Jumper will record the same transaction under different event names, which breaks cross-tool attribution.

Suggested fix
     }: TrackTransactionProps) => {
+      const dataAction = data[TrackingEventParameter.Action] ?? action ?? '';
       if (!disableTrackingTool?.includes(EventTrackingTool.GA)) {
-        googleEvent({ action, category, data });
+        googleEvent({ action: dataAction, category, data });
       }
       if (!disableTrackingTool?.includes(EventTrackingTool.JumperTracking)) {
-        const dataAction = data[TrackingEventParameter.Action] ?? action ?? '';
         const flagVariants = getFeatureFlagVariants(dataAction);
         await trackJumperTransaction({
           ...sessionContext,
           ...buildTransactionPayload(data),
           action: dataAction,
@@
       if (enableAddressable) {
         addressableEvent({
-          action,
+          action: dataAction,
           label: 'transaction',
           data: data || {},
           isConversion: true,
         });
       }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hooks/userTracking/useUserTracking.ts` around lines 216 - 237, Compute a
single resolved action (e.g., const resolvedAction =
data[TrackingEventParameter.Action] ?? action ?? '') at the top of the
transaction block and use that resolvedAction for every tracking sink
(googleEvent, trackJumperTransaction's action field, and addressableEvent's
action) instead of passing the original action or
data[TrackingEventParameter.Action] separately; update references in
useUserTracking.ts (googleEvent, trackJumperTransaction payload, and
addressableEvent) and keep other payload fields identical (including
abTestVariants/flagVariants logic) so all tools record the same event name for
cross-tool attribution.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/hooks/userTracking/useUserTracking.ts`:
- Around line 216-237: Compute a single resolved action (e.g., const
resolvedAction = data[TrackingEventParameter.Action] ?? action ?? '') at the top
of the transaction block and use that resolvedAction for every tracking sink
(googleEvent, trackJumperTransaction's action field, and addressableEvent's
action) instead of passing the original action or
data[TrackingEventParameter.Action] separately; update references in
useUserTracking.ts (googleEvent, trackJumperTransaction payload, and
addressableEvent) and keep other payload fields identical (including
abTestVariants/flagVariants logic) so all tools record the same event name for
cross-tool attribution.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ec371124-5d43-44cf-b2d5-7bdebbd03c24

📥 Commits

Reviewing files that changed from the base of the PR and between 057c3c9 and 4cc1d02.

📒 Files selected for processing (1)
  • src/hooks/userTracking/useUserTracking.ts

@mmioana mmioana force-pushed the feature/jum-844-switch-feature-flag-logic-from-posthog-to-strapi branch from 4cc1d02 to 44f8894 Compare May 5, 2026 11:26
@mmioana mmioana merged commit ef77635 into develop May 5, 2026
18 checks passed
@mmioana mmioana deleted the feature/jum-844-switch-feature-flag-logic-from-posthog-to-strapi branch May 5, 2026 11:56
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.

2 participants