Any way to add an associated url redirect to a content view?
Set that variable in the user's $_SESSION and then when an order gets created, check to see if that $_SESSION variable is there when you save a new order and if it is, write it to $order-&gt;data.

Alternatively, you can check out Commerce Affiliate which allows you to set up affiliates and provides some extra conditions and actions that you can use. This includes grabbing URL params and storing them on the session.