conversion-event-tracking
Skill1 starsChanged 18 days agoMITView on GitHub
Send commerce analytics events with stable names, item ids, and a purchase event that fires once from a confirmed order. Use when adding or changing view_item, add_to_cart, begin_checkout, purchase, or refund tracking.
In this repository28 other files it gives its agents.
- b2b-pricingSkill
- catalog-import-and-migrationSkill
- checkout-ux-and-conversionSkill
- ecommerce-seo-structured-dataSkill
- fraud-and-risk-basicsSkill
- google-merchant-product-feedsSkill
- headless-nextjs-storefrontSkill
- inventory-and-multi-warehouseSkill
- iranian-payment-gatewaysSkill
- marketplace-search-and-rankingSkill
- mcp-store-toolingSkill
- multi-vendor-payoutsSkill
- order-and-webhook-reliabilitySkill
- payment-gateway-integrationSkill
- product-catalog-modelingSkill
- product-description-guardrailsSkill
- returns-and-refundsSkill
- rtl-and-persian-localizationSkill
- shopify-app-developmentSkill
- storefront-accessibilitySkill
- storefront-performanceSkill
- stripe-paymentsSkill
- subscription-billingSkill
- tax-and-shippingSkill
- vector-product-searchSkill
- woocommerce-plugin-developmentSkill
- woocommerce-rest-apiSkill
- wordpress-plugin-securitySkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Use this skill for measurement events.
- Very specific: line 19
Use the recommended names: view_item, add_to_cart, begin_checkout, add_shipping_info, add_payment_info, purchase, and refund.
- Very specific: line 22
If value is set, set currency to the order's ISO 4217 code.
- Distinctive: line 40
Do not put the customer's name, email, or phone on the item or the event.
- Distinctive: line 44
If the shop requires consent for advertising measurement, do not load those tags before the choice is stored.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Conversion event tracking
Use this skill for measurement events. Checkout behavior is the checkout skill. Firing purchase before the payment skill confirms the order will count money you did not take.
Event names and parameter rules below follow Google's GA4 recommended ecommerce events. Other analytics tools should use the same payload shape in this project so there is one server-side record. Re-check GA4's event reference if a report disagrees with a parameter.
Procedure
- Use the recommended names:
view_item,add_to_cart,begin_checkout,add_shipping_info,add_payment_info,purchase, andrefund. - Send
itemswithitem_id(the SKU or stable unit id) anditem_name. Includepriceandquantitywhen you sendvalue. - Set
valueto the sum ofprice * quantity. Do not include shipping or tax invalue. Send those asshippingandtaxonpurchase. - If
valueis set, setcurrencyto the order's ISO 4217 code. - Fire
purchaseonce, from the server-confirmed payment, with a non-emptytransaction_idequal to the order number. - Respect the shop's consent settings before loading advertising tags. Do not describe that as a universal legal rule. The shop's policy decides where consent is required.
Parameter checks are in the event notes. Run node scripts/check-event.mjs --file event.json. Worked examples and checks are in evals/tasks.json.
Purchase
transaction_id is required for purchase. GA4 deduplicates purchases that share a transaction id on web streams. An empty string is a bad id: Google documents that purchases with transaction_id="" are deduplicated together. Never send an empty id.
The thank-you page may render the event only if a reload will send the same transaction_id. Prefer sending purchase from the server when payment is confirmed, and treat the browser event as a duplicate of that id rather than a second order.
value excludes tax and shipping. A 10.00 item, 1.00 tax, and 2.00 shipping is value: 10, tax: 1, shipping: 2, not value: 13.
Items
item_idis the purchasable unit, not only the parent, when variants have different prices.quantityis an integer greater than zero for a purchase line.- Do not put the customer's name, email, or phone on the item or the event.
Consent and duplicates
- If the shop requires consent for advertising measurement, do not load those tags before the choice is stored.
- Order-state analytics the merchant runs on their own server can still record the paid order. Keep that separate from a browser advertising tag.
refunduses the sametransaction_idas the purchase and the refundeditemsor value. Do not reuse a purchase event to mean a refund.
Gotchas
- Firing
purchaseon button click counts failed payments. - A new transaction id on every page load defeats deduplication and over-counts.
- Summing tax into
valueoverstates item revenue in GA4's definition. - Debug views that use a constant transaction id will collapse real orders together if that code ships.
Verification
- The checker accepts a purchase whose
valueequals the item sum and rejects a purchase with an emptytransaction_id. - A declined payment does not emit
purchase. - Reloading the confirmation page does not create a second transaction id.
- Item ids on variant products are variant SKUs.
Evaluation
Worked examples and the checks they must satisfy are in evals/tasks.json.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

