Assumptions: I assume your website is PHP based or you are using CMS (Content Management System) like WordPress. You have working knowledge of HTML & CSS.
Description from Apple Developer Website: Safari has a new Smart App Banner feature in iOS 6 and later that provides a standardised method of promoting apps on the App Store from a website, as shown below:
There is 100% possibility that you may have more than 2 apps published on AppStore & you want to promote those app on your website by rotating smart app banner for each of the app.
Use following code to deploy randomly rotating smart app banner for multiple apps:
Important Note: Change ‘app-id=‘ to your App’s specific App ID retrieved from iTunes Connect & Change ‘affiliate-data=‘ to your affiliate code taken from iTunes Affiliate website or leave blank or remove it from the code.
<?php $bannerAd[1] = '<meta name="apple-itunes-app" content="app-id=607983895, affiliate-data=at=11lsBN">'; $bannerAd[2] = '<meta name="apple-itunes-app" content="app-id=848192423, affiliate-data=at=11lsBN">'; $bannerAd[3] = '<meta name="apple-itunes-app" content="app-id=861903402, affiliate-data=at=11lsBN">'; $adCount = count($bannerAd); $randomAdNumber = mt_rand(1, $adCount); echo $bannerAd[$randomAdNumber]; ?>
Note: Copy paste above code in your website’s header below meta data tag.
I have added 3 apps to above code If you want to add fourth app then you can add following code to below 3rd line from top
$bannerAd[4] = '<meta name="apple-itunes-app" content="app-id=893221440, affiliate-data=at=11lsBN">';
Now your smart app banner code with 4 apps will look someting like this:
<?php $bannerAd[1] = '<meta name="apple-itunes-app" content="app-id=607983895, affiliate-data=at=11lsBN">'; $bannerAd[2] = '<meta name="apple-itunes-app" content="app-id=848192423, affiliate-data=at=11lsBN">'; $bannerAd[3] = '<meta name="apple-itunes-app" content="app-id=861903402, affiliate-data=at=11lsBN">'; $bannerAd[4] = '<meta name="apple-itunes-app" content="app-id=893221440, affiliate-data=at=11lsBN">'; $adCount = count($bannerAd); $randomAdNumber = mt_rand(1, $adCount); echo $bannerAd[$randomAdNumber]; ?>
If you want to learn more about ’Smart App Banner’ navigate to this link.
Hope it helps,
Thanks & Regards
Mandar Apte