Skip to content

[Payment due @ikevin127] Split workspace_created conversion event into two events for ad platforms - #92446

Merged
lakchote merged 6 commits into
mainfrom
worktree-youssef-lr-644512-app-split-workspace-created-event
Jun 17, 2026
Merged

lakchote merged 6 commits into
mainfrom
worktree-youssef-lr-644512-app-split-workspace-created-event

Conversation

@youssef-lr

@youssef-lr youssef-lr commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Splits the single workspace_created conversion event into two separate events across Google and Meta so the ad platforms can optimize bids toward higher-value leads. As part of this change, all Reddit (rdt) and LinkedIn (lintrk) pixel tracking is removed — we now only fire conversion events to Google (dataLayer) and Meta (fbq).

New behavior

  • workspace_created_sales_eligible — fired when all of the following are true:

    • Onboarding intent = Manage my team
    • Company size ≥ 5 employees
    • Email domain is private (not a public/free domain)

    This event uses the standard Meta Lead event so Meta's pre-trained conversion models can optimize toward these high-value leads.

  • workspace_created — fired for all other workspace creations. It now uses a custom Meta event (workspace_created) so the higher-volume, lower-value conversions don't dilute the standard Lead optimization for the sales-eligible segment.

Implementation

  • Added CONST.ANALYTICS.EVENT.WORKSPACE_CREATED_SALES_ELIGIBLE and marked WORKSPACE_CREATED with IS_CUSTOM_PIXEL_EVENT so GoogleTagManager.publishEvent emits fbq('trackCustom', …) for it and a standard fbq('track', …) call for the sales-eligible event.
  • Removed all Reddit (rdt) and LinkedIn (lintrk) pixel tracking from GoogleTagManager/index.ts, along with the now-unused REDDIT/LINKEDIN fields on the analytics event constants.
  • Added getWorkspaceCreatedAnalyticsEvent, which encapsulates the sales-eligibility criteria and returns the correct event name.
  • Applied the decision at both firing sites: createWorkspace (Policy) and categorizeTrackedExpense (TrackExpense).

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/644512
PROPOSAL: N/A (internal)

Tests

These changes are covered by automated unit tests (tests/unit/getWorkspaceCreatedAnalyticsEventTest.ts, tests/unit/GoogleTagManagerPublishEventTest.ts, and tests/unit/GoogleTagManagerTest.tsx). To validate manually:

  1. Enable third-party scripts (USE_THIRD_PARTY_SCRIPTS=true in .env) and open the JS console.
  2. As a brand-new account (no existing admin workspaces), go through onboarding selecting Manage my team, a company size of 5-10 (or larger), using a private email domain (e.g. you@yourcompany.com), and create a workspace.
  3. Verify the [GTM] event published log shows event workspace_created_sales_eligible, and on web that fbq('track', 'Lead', …) fires.
  4. Repeat with a public email domain (e.g. you@gmail.com), a company size of 1-4, or an intent other than Manage my team.
  5. Verify the published event is workspace_created, and on web that the Meta call uses the custom event form (fbq('trackCustom', 'workspace_created', …)).
  6. Verify that no errors appear in the JS console.
  • Verify that no errors appear in the JS console

Offline tests

Conversion events only fire when online (they depend on third-party pixel scripts). No offline-specific behavior changes.

QA Steps

Same as Tests. Conversion-pixel firing is best verified by Marketing against the GTM/Meta dashboards once deployed; the user-facing workspace-creation flow is unchanged.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

…orms

Splits the single `workspace_created` conversion event into two so Google,
Meta, and Reddit can optimize bids toward higher-value leads:

- `workspace_created_sales_eligible` fires when all of: onboarding intent is
  "Manage my team", company size is 5+ employees, and the email domain is
  private. It uses the standard "Lead" Meta/Reddit event so the platforms'
  pre-trained conversion models optimize toward these leads.
- `workspace_created` fires for all other workspace creations and now uses a
  custom Meta/Reddit event, so the higher-volume, lower-value conversions don't
  dilute the standard "Lead" optimization.

The decision lives in getWorkspaceCreatedAnalyticsEvent and is applied at both
firing sites (createWorkspace and categorizeTrackedExpense). LinkedIn is paused
and intentionally left unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@youssef-lr
youssef-lr requested review from a team as code owners June 2, 2026 23:05
@melvin-bot
melvin-bot Bot requested review from JmillsExpensify and ikevin127 and removed request for a team and JmillsExpensify June 2, 2026 23:05
@melvin-bot

melvin-bot Bot commented Jun 2, 2026

Copy link
Copy Markdown

@ikevin127 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot removed the request for review from a team June 2, 2026 23:05

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13dca42223

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

*/
function getWorkspaceCreatedAnalyticsEvent(engagementChoice: string | undefined, companySize: string | undefined, email: string): GoogleTagManagerEvent {
const isSalesEligible =
engagementChoice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM && !!companySize && SALES_ELIGIBLE_COMPANY_SIZES.has(companySize) && !!email && !isEmailPublicDomain(email);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require a real email domain before marking sales eligible

When a new user signs up with a phone-number login (the app stores those as SMS logins, e.g. session.email ending in CONST.SMS.DOMAIN as checked in useHasPhoneNumberLogin), this condition treats it as a private-domain email because it only verifies the value is non-empty and not in the public-domain set. A Manage-my-team user with 5+ employees but no actual email domain would therefore fire workspace_created_sales_eligible, even though the documented criterion is a private email domain; please reject SMS/invalid logins or require a valid non-SMS email before returning the sales-eligible event.

Useful? React with 👍 / 👎.

@ikevin127

Copy link
Copy Markdown
Contributor

@youssef-lr If this PR needs my C+ review, please tag me once all workflows are 🟢 and PR si ready for review.

@youssef-lr
youssef-lr marked this pull request as draft June 2, 2026 23:23
@youssef-lr
youssef-lr removed the request for review from ikevin127 June 2, 2026 23:24
@youssef-lr

Copy link
Copy Markdown
Contributor Author

This doesn't need a C+ review @ikevin127. Sorry it was supposed to be created as a draft.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/CONST/index.ts 93.84% <ø> (ø)
src/libs/GoogleTagManager/index.ts 93.33% <100.00%> (+93.33%) ⬆️
src/libs/actions/IOU/TrackExpense.ts 80.73% <100.00%> (+0.20%) ⬆️
src/libs/actions/Policy/Policy.ts 71.60% <100.00%> (+0.02%) ⬆️
src/libs/getWorkspaceCreatedAnalyticsEvent.ts 100.00% <100.00%> (ø)
... and 124 files with indirect coverage changes

@youssef-lr
youssef-lr marked this pull request as ready for review June 12, 2026 06:41
@youssef-lr
youssef-lr requested a review from ikevin127 June 12, 2026 06:42
@youssef-lr

Copy link
Copy Markdown
Contributor Author

Hey Kevin! I added you back as a reviewer. Please note this only needs to be tested on Web.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 855dfffcb1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/CONST/index.ts Outdated
WORKSPACE_CREATED: {
NAME: 'workspace_created',
META: 'workspace_created',
REDDIT: 'Lead',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Send non-eligible workspace events as Reddit custom events

For non-sales-eligible workspace creations, this still configures the Reddit pixel event as Lead. publishEvent only applies IS_CUSTOM_PIXEL_EVENT to Meta and still calls rdt('track', pixelEvent.REDDIT, ...), so any workspace that falls back to workspace_created continues to hit Reddit's standard Lead conversion and dilutes the sales-eligible Lead optimization the split is meant to protect. Use Reddit's custom event form/name for this branch as well.

Useful? React with 👍 / 👎.

@ikevin127

ikevin127 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Screen.Recording.2026-06-12.at.16.01.24.mov

@ikevin127

Copy link
Copy Markdown
Contributor

🟢 The PR successfully splits the workspace_created analytics event into two events (workspace_created and workspace_created_sales_eligible) based on sales-eligibility criteria, and removes Reddit/LinkedIn pixel tracking. The approach is clean, well-encapsulated, and the new pure function getWorkspaceCreatedAnalyticsEvent is a strong addition ✅

⚠️ However, there are several significant issues that need addressing before this should be merged:

  1. PR description seems misleading, claiming LinkedIn is "paused and unchanged" and Reddit is still tracked, but the code removes both entirely, this seems like a significant documentation issue.
  2. Missing test coverage for the sales-eligible path via categorizeTrackedExpense, and for the fbq('trackCustom') vs fbq('track') branching.
  3. Inconsistent email handling between the two firing sites (Policy.ts provides no fallback, TrackExpense.ts does).

@youssef-lr This is after the initial PR overview look, I'm continuing the code review 🔄

Comment thread src/CONST/index.ts
Comment on lines -7680 to -7687
REDDIT: 'Lead',
LINKEDIN: 25474804,
},
PAID_ADOPTION: {
NAME: 'paid_adoption',
META: 'Purchase',
REDDIT: 'Purchase',
LINKEDIN: 25474820,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 MEDIUM — PR Description Mismatch

The PR description says "LinkedIn is paused and intentionally left unchanged" and "Uses a custom Meta/Reddit event", but the code completely removes all rdt (Reddit) and lintrk (LinkedIn) tracking from GoogleTagManager/index.ts. This is a significant inconsistency, either the code is correct and the description needs updating, or the description is correct and the code is wrong.

Fix: Update the PR description to explicitly state that Reddit and LinkedIn tracking is being removed from all pixel events, and this PR only targets Meta. Alternatively, if the intent is to keep them, the code must be restored.

Question: Were Reddit and LinkedIn intentionally dropped, or is this an accidental deletion ? Since the commit history shows "Remove reddit & meta" followed by "Apply changes only to Google & Meta", this seems intentional, but the PR description must be updated.


// Standard events (e.g. "Lead") tap into Meta's pre-trained conversion models, so we only mark an event as
// custom when we intentionally don't want it optimized against the standard event.
const isCustomPixelEvent = 'IS_CUSTOM_PIXEL_EVENT' in pixelEvent && pixelEvent.IS_CUSTOM_PIXEL_EVENT;

@ikevin127 ikevin127 Jun 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟠 HIGH — Missing test coverage for trackCustom vs track branching

The PR introduces a new isCustomPixelEvent flag that changes the fbq call REQ method, but there is no test verifying this behavior. The existing GoogleTagManagerTest.tsx only mocks the module and tests the calling code, not the internal fbq invocation logic. This means the fbq('trackCustom', ...) vs fbq('track', ...) distinction is completely untested.

Fix: Add a test for GoogleTagManager.publishEvent that:

  1. Mocks window.dataLayer and window.fbq
  2. Verifies that WORKSPACE_CREATED triggers fbq('trackCustom', 'workspace_created', ...)
  3. Verifies that WORKSPACE_CREATED_SALES_ELIGIBLE triggers fbq('track', 'Lead', ...)

Example of what untested code could hide: A future developer could accidentally change isCustomPixelEvent ? 'trackCustom' : 'track' to always use 'track' and the existing tests would still pass, but Meta would incorrectly optimize the wrong conversions.

🟡 MEDIUM — IS_CUSTOM_PIXEL_EVENT could be more type-safe

The check IS_CUSTOM_PIXEL_EVENT in pixelEvent && pixelEvent.IS_CUSTOM_PIXEL_EVENT works at runtime but the optional property isn't strongly typed in the typeof CONST.ANALYTICS.EVENT[...] type. The PIXEL_EVENTS array is typed as const from CONST.ANALYTICS.EVENT, which includes all event configs. This is fine but could be cleaner with an explicit type.

Suggestion: Consider defining a typed interface for pixel events rather than relying on runtime 'in' checks. Not a blocker.

@@ -204,6 +204,50 @@ describe('GoogleTagManagerTest', () => {
expect(GoogleTagManager.publishEvent).toHaveBeenCalledWith(CONST.ANALYTICS.EVENT.WORKSPACE_CREATED.NAME, 123456, email);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟠 HIGH — Missing test for categorizeTrackedExpense with sales-eligible criteria

The categorizeTrackedExpense test starting at line 251 still expects WORKSPACE_CREATED.NAME with default params. There is no test verifying that when trackExpense is called with sales-eligible createdWorkspaceParams (i.e., engagementChoice: MANAGE_TEAM, companySize: MICRO_MEDIUM, private email), it correctly publishes WORKSPACE_CREATED_SALES_ELIGIBLE.NAME.

Fix: Add a new test case:

test('workspace_created_sales_eligible - categorizeTrackedExpense', async () => {
    // TODO: Mock createdWorkspaceParams with sales-eligible criteria
    // and verify the correct event is published
});

🟡 MEDIUM — The categorizeTrackedExpense test (line 251) does not override createdWorkspaceParams:

The trackExpense call in the existing test does not include createdWorkspaceParams (it only appears to accept specific fields).

Should verify: does the test's trackExpense function even populate createdWorkspaceParams ? Looking at the test, the params passed to trackExpense do not include createdWorkspaceParams. This means at runtime createdWorkspaceParams is likely undefined, which causes getWorkspaceCreatedAnalyticsEvent(undefined, undefined, ...) to return the STANDARD event. The test will pass, but there's no verification that the function works correctly when createdWorkspaceParams IS populated.

Fix: Add a test case for categorizeTrackedExpense that includes explicit createdWorkspaceParams with sales-eligible values.

@ikevin127 ikevin127 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 LGTM - Tests well

NAB: The core logic is sound but the PR needs:

  1. Potential description correction
  2. 2-3 more test cases.

Once these are addressed, it's ready to merge ✅ See comments above for details.

@melvin-bot
melvin-bot Bot requested a review from lakchote June 12, 2026 23:29
@melvin-bot

melvin-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

@lakchote Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot Bot changed the title Split workspace_created conversion event into two events for ad platforms [Payment due @ikevin127] Split workspace_created conversion event into two events for ad platforms Jun 12, 2026
@melvin-bot

melvin-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

🎯 @ikevin127, thanks for reviewing and testing this PR! 🎉

A payment issue will be created for your review once this PR is deployed to production.
E/E issue linked to the PR - https://www.github.com/Expensify/Expensify/issues/644512.

If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created.

@lakchote

Copy link
Copy Markdown
Contributor

@youssef-lr please handle comments from @ikevin127 above, for thoroughness

Youssef Lourayad and others added 2 commits June 16, 2026 00:49
Address review feedback:
- Add GoogleTagManagerPublishEventTest covering the real publishEvent
  fbq('trackCustom') vs fbq('track') branching, which the existing
  module-mocked test could not exercise.
- Document why the categorizeTrackedExpense path always publishes the
  standard workspace_created event (it builds the workspace with the
  TRACK_WORKSPACE intent, which is never sales-eligible).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@youssef-lr

Copy link
Copy Markdown
Contributor Author

Updated!

@ikevin127

Copy link
Copy Markdown
Contributor

Thank you! @lakchote LGTM, on to you.

@lakchote lakchote left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@lakchote
lakchote merged commit 00c9fe2 into main Jun 17, 2026
32 checks passed
@lakchote
lakchote deleted the worktree-youssef-lr-644512-app-split-workspace-created-event branch June 17, 2026 14:54
@github-actions

Copy link
Copy Markdown
Contributor

🚧 @lakchote has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/lakchote in version: 9.4.10-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 No help site changes required.

I reviewed the changes in this PR and confirmed they do not require any updates to the help site files under App/docs/articles.

Why: This PR changes only internal marketing/analytics conversion tracking — splitting the workspace_created event into workspace_created (custom Meta event) and workspace_created_sales_eligible (standard Meta Lead event), and removing Reddit/LinkedIn pixel tracking. These events fire to ad platforms (Google dataLayer / Meta fbq) for bid optimization and are invisible to end users. As the PR itself notes, "the user-facing workspace-creation flow is unchanged."

I also searched App/docs/articles for any references to conversion events, tracking pixels, GoogleTagManager, fbq/dataLayer, or Reddit/LinkedIn pixels — there are none. The help site documents customer-facing product behavior (creating a workspace, onboarding, etc.), none of which is affected by this change.

No draft PR was created since there is nothing to document.

@youssef-lr, please confirm you agree no help site changes are needed. If you believe a user-facing behavior did change and should be documented, let me know and I'll draft the docs PR.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/lakchote in version: 9.4.12-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Help site review — no docs changes required.

This PR changes only internal conversion-pixel/analytics instrumentation for workspace creation:

  • Splits the workspace_created conversion event into workspace_created (custom Meta event) and workspace_created_sales_eligible (standard Meta Lead event) for Google (dataLayer) and Meta (fbq).
  • Removes Reddit (rdt) and LinkedIn (lintrk) pixel tracking.
  • Adds the sales-eligibility decision logic (getWorkspaceCreatedAnalyticsEvent) and applies it at the two firing sites.

None of this alters any user-facing behavior — as the PR itself notes, "the user-facing workspace-creation flow is unchanged." The events fire silently to ad-platform dashboards and are only meaningful to Marketing via GTM/Meta.

The Expensify help site (App/docs/articles) documents user-facing product features (how to create a workspace, manage members, billing, etc.). It does not — and should not — document internal marketing conversion tracking. A search of docs/articles for any analytics/pixel terminology (workspace_created, fbq, Google Tag Manager, Meta/Reddit/LinkedIn pixels) returned no matches.

Conclusion: No help site article needs to be created or updated, so no draft docs PR was opened.

@youssef-lr, if you believe any customer-facing documentation is affected that I may have missed, let me know and I'll create the docs PR.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/lakchote in version: 9.4.14-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/puneetlath in version: 9.4.14-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@melvin-bot

melvin-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

🤖 Payment issue created: #93958

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.

5 participants