You're looking for "Smart App Banners".
Usage is as simple as adding the following meta tag to your web page's source code, specifying the Apple App Store ID some affiliate data, and even a URL scheme argument.
<meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">