Add Smart App Banner for iOS & Android on specific page

4k views Asked by At

I need to add a smart app banner for iOS and Android versions of a native app when users visit the client site on a variety of small screen devices. Using the meta tag method described here

for iOS devices, I'd like to also include the meta tag method for Android devices, if this exists. The code would also need to query if the user was viewing a particular page on this Wordpress site (query by page-ID) and what device they were actually viewing on.

I'm aware the meta tag for iOS needs to be in the format:

<meta name="apple-itunes-app" content="app-id=123467, affiliate-data=myAffiliateData, app-argument=myURL">

I've also read elsewhere the php query for the device is this:

<?php

$iPod   = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad   = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
$droid  = stripos($_SERVER['HTTP_USER_AGENT'],"Android");

if ($iPod || $iPhone || $iPad){
    //Display Smart App Banner prompt for iOS
} else if($droid){
    // Display Smart App Banner Prompt for Android
}

But I'm not aware of the meta tag for Android, or how I'd combine them all together and check the page they are on (so banner doesn't display sitewide) and incorporate into Wordpress site.

Hopefully someone cn help me with some code to try in functions.php of child theme or via a meta tag plugin (or hook within Canvas theme).

0

There are 0 answers