polar icon indicating copy to clipboard operation
polar copied to clipboard

Checkout: Store `attribution_id` & `utm_*` query params automatically in `metadata`

Open birkjernstrom opened this issue 9 months ago • 0 comments

Allow setting attribution via query params for the checkout that we store as an attribution object on checkout and pass to the order(s) & subscription(s). Useful for affiliate partners and sellers in general to use in combination with built-in efforts, e.g checkout links.

Rough idea: We would support attribution_id along with utm_* query params that would be set on the attribution object (JSON)

And set the following keys automatically in metadata:

{
  "attribution.id": "<?attribution_id>",
  "attribution.utm_source": "<?utm_source>",
  "attribution.utm_medium": "<?utm_medium>",
  "attribution.utm_campaign": "<?utm_campaign>",
}

In case such keys are set beforehand, the URL parameters should not override the preset values.

birkjernstrom avatar Mar 04 '25 16:03 birkjernstrom