Tracking external contribution sources
What we have done is to add 3 custom fields to the contribution (utm_source, utm_media and utm_campaign) that store the tracking codes, the same way google analytics work.

To make it more automatic, we have an extension that does automatically adds these codes to all the links sent from civimail, so we have end to end tracking.

We haven't yet published this extension in civicrm.org, but you can fetch it from our github repository.
https://github.com/WeMoveEU/utmaltor