Fix Ads conversion value, gate on Measurement ID, unify payloads, add events and tests - #8
Conversation
…, add events and tests - Ads conversion sends total_incl_tax (was total_tax) and the snippet now configures the AW- tag so send_to can attribute (#2) - Snippet and tracker do nothing until a Measurement ID is set; tracker calls are guarded so pages without the snippet never throw (#3) - user_id and debug_mode share one config object (#4) - Numeric money fields, per-unit price/discount, one item shape across the funnel, page fields out of items[] (#5) - view_item_list, remove_from_cart, add_shipping_info; Skip Test Orders setting (#6) - Google Ads / Next Commerce naming in labels and README (#7) - Node test harness running tracking.js with platform globals, CI workflow Closes #2, closes #3, closes #4, closes #5, closes #6, closes #7 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Code Review SummaryStatus: No Issues Found | Recommendation: Merge This incremental push is documentation-only: the README now spells out that Files Reviewed (2 incremental files)
Previous Review Summaries (7 snapshots, latest commit d643ea4)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit d643ea4)Status: No Issues Found | Recommendation: Merge This incremental push introduces Files Reviewed (4 incremental files)
Previous review (commit c9956c6)Status: No Issues Found | Recommendation: Merge The two outstanding items from the previous review are fixed in this push:
Files Reviewed (4 incremental files)
Previous review (commit 56e9501)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Previously Reported — Resolved in This PushAll three findings from the previous review are fixed:
Also addressed in this push: Files Reviewed (5 incremental files)
Fix these issues in Kilo Cloud Previous review (commit 56a6421)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (4 incremental files)
Fix these issues in Kilo Cloud Previous review (commit 9cd6842)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
Files Reviewed (4 incremental files)
Fix these issues in Kilo Cloud Previous review (commit 3c9d8ec)Status: No Issues Found | Recommendation: Merge Files Reviewed (3 incremental files)
Previously Reported — Addressed in this pushThe outstanding
Previous review (commit 85e4ab9)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Previously Reported — Addressed in this pushAll 7 prior findings were resolved in commit
Files Reviewed (3 incremental files)
Reviewed by minimax-m3 · Input: 42.8K · Output: 1.5K · Cached: 271.7K |
…rbitrary sku, validate AW- id - escapejs/urlencode on every setting interpolated into the snippet's JS - product_category_viewed skips null entries; list identified by path + title - view_item only names a sku when the product has one or a single variant - unit price/discount left undefined when quantity is not positive - Ads conversion requires an AW-<digits> id - tests for begin_checkout (two lines), null category entries, missing quantity, and a bare Ads id Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…w_item Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…op cart events without a line, Node version in README Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…nt, item-revenue value, Ads id normalisation, list cap, coupon and null-product guards - storefront() reaches window.parent (the tracker frame is a direct child) and every access is wrapped, so a cross-origin parent never throws; send_to targets the configured Measurement ID; begin_checkout/add_shipping_info/purchase value is the sum of the lines; Ads id normalised identically in snippet and tracker (strip, upper, AW- prefix for bare digits) and label trimmed; coupon omitted when absent; checkout lines without a product dropped; item lists capped at 200; checkout events without a payload dropped. Tests cover each, plus a snippet escaping guard. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Second review pass (gstack: 2 specialists + Claude and Codex adversarial passes, verified read-only against oscar-prime)Pushed as one commit on top of the Kilo fixes:
Two things are deliberately not here: purchase dedupe (platform-owned, Process, per the app-development-flow docsThis PR is the code review. Distribution is App Kit: |
…e in one place
The template cut filter stripped every AW- occurrence and the snippet gate could not mirror the tracker regex, so the snippet no longer touches the Ads settings; tracking.js validates id and label (alphanumeric, _ and -) and calls gtag('config', 'AW-...') at startup. Tests cover the startup config, malformed ids, and labels with / or quotes.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…hangelog says the tracker configures the Ads tag Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… is reported separately Observed on the aptest full-funnel walk: order line price_incl_tax includes tax, so purchase value carried tax while tax was also sent. Fixture lines now carry distinct excl/incl values. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Release-candidate walk on the development store (aptest.29next.store, 2026-09-03)Deployed with
Order 110985 (before the last commit) showed value 64.19 because the order line's Not exercised on this store: the Ads |
…nt being total_discount as sent Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Handoff from the review filed as #2 to #7. Each issue maps to a bullet below; the tracker is rewritten around one guarded
send()and one item builder so the fixes are easy to check line by line.What changes
conversionvalue istotal_incl_tax(wastotal_tax). The snippet now runsgtag('config', '<AW-id>')when Ads tracking is on, whichsend_toneeds to attribute. Help text asks for theAW-prefix, matching howsend_tois built.google_analytics_measurement_idbeing non-empty.send()checkswindow.top.gtagexists before calling, so themes without theglobal_headerhook do not throw in the tracker frame.user_idanddebug_modeare one config object.parseFloat;priceanddiscountare per unit (line total ÷ quantity, rounded to cents); every event uses the same item shape (item_id= product id,sku,item_variant,item_categorywhere the payload has it); page fields are no longer insideitems[](gtag on the top window collects them).product_category_viewed → view_item_list,product_removed_from_cart → remove_from_cart,checkout_shipping_method_submitted → add_shipping_info(withshipping_tier). New "Skip Test Orders" setting, default off so existing installs do not change behaviour.Deliberately not included
add_payment_info: the platform emits no payment-step event.denieddefaults without a CMP to update them would blank out measurement for every merchant, so it needs its own design.How to verify
npm testrunstracking.jsunder the platform's globals (app,analytics,window.top) with payloads from the event-tracking docs and asserts every mapped event. CI workflow added.Closes #2, closes #3, closes #4, closes #5, closes #6, closes #7
🤖 Generated with Claude Code