Skip to content

feat(gaoc): add flagged store sales item attribution - #5684

Merged
maheshkutty merged 6 commits into
developfrom
harness/INT-7377-feat-gaoc-add-flagged-store-sal-7656b077
Oct 19, 2026
Merged

maheshkutty merged 6 commits into
developfrom
harness/INT-7377-feat-gaoc-add-flagged-store-sal-7656b077

Conversation

@rudder-devbox

@rudder-devbox rudder-devbox Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Write a brief explainer on your code changes.

What is the related Linear task?

Resolves INT-7377

Please explain the objectives of your changes below

Adds Google Ads Store Sales transaction_attribute.item_attribute support, enabled per workspace through the GAOC_STORE_SALES_ITEM_ATTRIBUTION env flag (ALL or a comma-separated workspace list). An item attribute is emitted only when both an item ID and a merchant ID resolve.

  • No properties.products, or an empty array: item fields come from flat properties — item_id → product_id → sku, plus quantity.
  • Non-empty properties.products (one or many entries): one item per product. Each product supplies its own item ID (product_id → sku) and quantity; flat item_id/quantity are ignored. This follows the Ecommerce spec, where Order Completed carries product fields only inside products[]. merchant_id, country_code and language_code are shared from the flat properties.
  • Multi-item baskets fan out into one operation per attributable product, grouped by the shared order_id, because Google allows one item_attribute per transaction. Products without an item ID are skipped; if none resolve, the event stays aggregate-only.
  • quantity must be a positive safe integer (number or digit string), otherwise it is omitted and Google defaults it to 1. merchant_id is kept as a decimal string (it can exceed the safe-integer range) or converted from a positive safe integer; otherwise the item attribute is dropped.

Item fields live in their own TrackStoreItemAttributeConfig.json mapping, applied only when the flag is on, so TrackAddStoreConversionsConfig.json is unchanged.

Validation:

  • npm test -- --testPathPattern="google_adwords_offline_conversions" --no-coverage — 68 passed
  • npm run test:ts -- component --destination=google_adwords_offline_conversions — 47 passed
  • generate:secret-paths for this destination — no change to the committed entry

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

Only for workspaces in the flag. Their Store Sales events can carry item_attribute, and a multi-item basket is sent as several operations, so addConversionPayload.operations holds one entry per item. Router batching was updated to append every operation of a fanned-out event. Flag-off, non-matching workspace, incomplete and invalid cases keep their existing aggregate-only payloads byte-for-byte. Click/call conversions, auth and delivery are unchanged; click cart-item building is the same as on develop.

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

N/A. The existing shared workspace feature-flag utility (isFeatureEnabled) is reused.

Any technical or performance related pointers to consider with the change?

The feature is not customer self-serve. Enrolled Google Ads accounts need item-attribute allow-list approval and a linked Merchant Center account.

⚠️ Known Issues

  • Revenue under fan-out (INT-7377 §5, option 3): every fanned-out operation carries the full order value in transaction_amount_micros, so Google reports N × the order value for an N-item basket. This is an accepted trade-off for the flag-gated pilot because the order value mapping stays unchanged; per-item value (unit price × quantity) is not calculated. Confirm with PM before enabling the flag broadly.
  • enable_partial_failure stays false, so one rejected item operation fails the whole basket.

Developer checklist

  • My code follows the style guidelines of this project

  • No breaking changes are being introduced.

  • All related docs linked with the PR?

  • All changes manually tested?

  • Any documentation changes needed with this change?

  • Is the PR limited to 10 file changes?

  • Is the PR limited to one linear task?

  • Are relevant unit and component test-cases added in new readability format?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

⚠️ Auto-review unresolved

Adversarial self-review surfaced findings that were not auto-fixed. Each carries its disposition — please evaluate before merging.

  • medium: Custom-key injection can bypass the Store Sales item-attribution feature gate — src/v0/destinations/google_adwords_offline_conversions/utils.js:363 — not auto-fixed (iteration budget exhausted)
  • medium: Byte-identical additivity tests derive the expected baseline from the same changed code — src/v0/destinations/google_adwords_offline_conversions/utils.test.js:630 — not auto-fixed (iteration budget exhausted)
  • medium: Feature-flag rollback does not protect already-transformed Store Sales payloads — src/v0/destinations/google_adwords_offline_conversions/transform.js:352 — not auto-fixed (iteration budget exhausted)
  • low: New router component cases duplicate the full Store Sales destination config instead of sharing a fixture — test/integrations/destinations/google_adwords_offline_conversions/router/data.ts:1504 — not auto-fixed (iteration budget exhausted)

@rudder-devbox

rudder-devbox Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

👋 I'm rudder-devbox. I opened this PR from a Linear ticket.

Mention @devbox or @rudder-devbox and I'll act on it — on a top-level PR comment,
in a review summary, or on an inline comment on the diff. Without a mention I won't see it.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 632c1e7f-2a9b-4b77-8892-3421ee7535b6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.18%. Comparing base (b6034ac) to head (1e1f31b).
⚠️ Report is 28 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5684      +/-   ##
===========================================
+ Coverage    92.12%   92.18%   +0.06%     
===========================================
  Files          713      720       +7     
  Lines        39600    40055     +455     
  Branches      9205     9306     +101     
===========================================
+ Hits         36481    36926     +445     
- Misses        2934     2945      +11     
+ Partials       185      184       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rudder-devbox

rudder-devbox Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

@rudder-devbox
rudder-devbox Bot requested a review from maheshkutty October 16, 2026 12:23
@rudder-devbox

rudder-devbox Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

@rudder-devbox
rudder-devbox Bot requested a review from maheshkutty October 19, 2026 05:22
@rudder-devbox

rudder-devbox Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

@rudder-devbox
rudder-devbox Bot requested a review from maheshkutty October 19, 2026 05:56
Google accepts one item_attribute per transaction, so a non-empty
properties.products array now produces one operation per product
(item_id from product_id, then sku, plus the product's quantity), with
merchant, country and language shared from the flat properties. A
single-product array follows the same path as a multi-product one;
flat item_id/quantity apply only when products is absent or empty.

Item attribute fields move to their own TrackStoreItemAttributeConfig
mapping so the store conversion mapping is unchanged when the flag is
off, and click conversion item building is restored to its original form.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.30.1
@maheshkutty
maheshkutty marked this pull request as ready for review October 19, 2026 06:48
@maheshkutty
maheshkutty requested review from a team as code owners October 19, 2026 06:48
@maheshkutty
maheshkutty requested a balanced review from Copilot October 19, 2026 06:53

Copilot AI 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.

🟡 Changes recommended

Merchant ID overflow and custom-key overwrites can produce invalid attribution payloads.

2 open issues
What changed in this PR

Adds workspace-gated item attribution to Google Ads Store Sales conversions.

Changes:

  • Maps and normalizes item attributes from flat properties or products.
  • Fans out baskets into per-item operations and updates router batching.
  • Adds unit/component coverage and documents pilot limitations.
File Description
test/​integrations/​destinations/​google_adwords_offline_conversions/​router/​data.ts Covers gated attribution and basket batching.
test/​integrations/​destinations/​google_adwords_offline_conversions/​processor/​data.ts Covers enabled, unmatched, and incomplete attribution.
src/​v0/​destinations/​google_adwords_offline_conversions/​utils.test.js Tests normalization, gating, and fan-out.
src/​v0/​destinations/​google_adwords_offline_conversions/​utils.js Builds item attributes and per-item operations.
src/​v0/​destinations/​google_adwords_offline_conversions/​transform.js Passes workspace metadata and flattens operations.
src/​v0/​destinations/​google_adwords_offline_conversions/​docs/​businesslogic.md Documents mappings and pilot trade-offs.
src/​v0/​destinations/​google_adwords_offline_conversions/​data/​TrackStoreItemAttributeConfig.json Defines item-field mappings.
src/​v0/​destinations/​google_adwords_offline_conversions/​config.js Registers the mapping and feature flag.

Review effort: Balanced

maheshkutty
maheshkutty previously approved these changes Oct 19, 2026
ItemAttribute.merchant_id is int64 in the Google Ads API, so coerce it
the same way as quantity: accept a number or digit string and send a
positive safe integer, matching the click path's cartData.merchantId.
Unsafe or non-integer values still leave the event aggregate-only.

Per-product item IDs now resolve item_id, then product_id, then sku via
the shared getValueFromMessage helper, matching the flat mapping, so a
product can carry a Merchant Center item ID that differs from its
product_id.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.30.1
@sonarqubecloud

Copy link
Copy Markdown

@maheshkutty
maheshkutty merged commit 9459b17 into develop Oct 19, 2026
38 checks passed
@maheshkutty
maheshkutty deleted the harness/INT-7377-feat-gaoc-add-flagged-store-sal-7656b077 branch October 19, 2026 08:32
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.

3 participants