The following basic PHP code will split traffic by device with iOS traffic going to the first out link, Android to the second and leftovers to the third.
TIP: This uses a 301 redirect however you can do any type of programmatic variation based on the user agent.
<?php
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
if (strpos($ua,'iphone') !== false || strpos($ua,'ipod') !== false || strpos($ua,'ipad') !== false) {
$out = 'https://iosoutlink.com/';
} elseif (strpos($ua,'android') !== false) {
$out = 'https://androidoutlink.com';
} else {
$out = 'https://allotherstuff.com';
}
header("HTTP/1.1 301 Moved Permanently");
header("Location: $out");
exit();
?>
You can copy and paste this into a myfile.php text file for example. Upload it to your server and any traffic you point to it http://mydomain/myfile.php will be redirected to the right app store or offer.