Generate Emails Based On Incoming Url Params

We want to track that which users are coming from which site and registering on our site.
And accordingly when they register we want to give them a coupon while registering. These coupons will differ from each site to site.
What params needs to be looked for in the url and how?
We have given our affiliates the utm params for our sites through which they send us the traffic. So we were thinking that somehow in the code if we can track this utm param (utm_source) we assign them different variables for coupons values which can sent as a message to the customer registering.
Basically we can use a translation variable for each site with diff coupons. But not sure how to track the incoming param and where to put it with the if condition.

Not clear exactly what you want. You are mixing promotions and affiliates in the same discussion.

You can use promotions to provide a coupon that can be used once upon customer registration. No custom code required.

You can add the utm into the user's session when it's seen and then use it later how ever you want. But storage and use would be custom based on your needs/wants.