Repository navigation
feat(gaoc): add flagged store sales item attribution - #5684
maheshkutty merged 6 commits into
Conversation
|
👋 I'm rudder-devbox. I opened this PR from a Linear ticket. Mention |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Knowledge distillation completed |
|
Knowledge distillation completed |
|
Knowledge distillation completed |
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
There was a problem hiding this comment.
🟡 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
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
|




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_attributesupport, enabled per workspace through theGAOC_STORE_SALES_ITEM_ATTRIBUTIONenv flag (ALLor a comma-separated workspace list). An item attribute is emitted only when both an item ID and a merchant ID resolve.properties.products, or an empty array: item fields come from flat properties —item_id→product_id→sku, plusquantity.properties.products(one or many entries): one item per product. Each product supplies its own item ID (product_id→sku) andquantity; flatitem_id/quantityare ignored. This follows the Ecommerce spec, whereOrder Completedcarries product fields only insideproducts[].merchant_id,country_codeandlanguage_codeare shared from the flat properties.order_id, because Google allows oneitem_attributeper transaction. Products without an item ID are skipped; if none resolve, the event stays aggregate-only.quantitymust be a positive safe integer (number or digit string), otherwise it is omitted and Google defaults it to1.merchant_idis 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.jsonmapping, applied only when the flag is on, soTrackAddStoreConversionsConfig.jsonis unchanged.Validation:
npm test -- --testPathPattern="google_adwords_offline_conversions" --no-coverage— 68 passednpm run test:ts -- component --destination=google_adwords_offline_conversions— 47 passedgenerate:secret-pathsfor this destination — no change to the committed entryAny 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, soaddConversionPayload.operationsholds 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 ondevelop.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.
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_failurestaysfalse, 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.
Adversarial self-review surfaced findings that were not auto-fixed. Each carries its disposition — please evaluate before merging.
src/v0/destinations/google_adwords_offline_conversions/utils.js:363— not auto-fixed (iteration budget exhausted)src/v0/destinations/google_adwords_offline_conversions/utils.test.js:630— not auto-fixed (iteration budget exhausted)src/v0/destinations/google_adwords_offline_conversions/transform.js:352— not auto-fixed (iteration budget exhausted)test/integrations/destinations/google_adwords_offline_conversions/router/data.ts:1504— not auto-fixed (iteration budget exhausted)