Hydrogen cart attribution
A successful execution can return an attribution token. Attach it to the matching Shopify cart line using the SDK helper rather than inventing a custom field.
import { createCartLineInputAttributes,} from '@aabhastech/shopify-vto/hydrogen';
const attributes = createCartLineInputAttributes(attributionToken);
await cart.addLines([ { merchandiseId: selectedVariant.id, quantity: 1, attributes, },]);The token is scoped to the shop, product, variant, and permitted line use. Never display or log it, and do not attach one product’s token to another variant.
Exact versus directional attribution
Section titled “Exact versus directional attribution”- A valid token preserved on the purchased line supports exact product attribution.
- Session or checkout correlation can support directional journey analysis.
- If an external checkout removes both the line property and correlation context, exact attribution is unavailable rather than zero.
Canonical Shopify order and payment facts determine completed purchases, refunds, and cancellations. A browser checkout event alone is not authoritative purchase truth.