Our client has requested that we add smart banners to our mobile site for both iOS and Android. We've implemented the meta tags required:
<meta name="apple-itunes-app" content="app-id=ourAppID">
<meta name="google-play-app" content="app-id=ourAppID">
This works. (We're using the jquery.smartbanner plugin for Android.)They've now amended the requirement; they want the banner to display only on the home page of the site, and only the first time the user hits the home page in a session.
<?php
if (empty($_SESSION['showSmartBanner']) && $_SERVER['REQUEST_URI'] === '/' ): ?>
<meta name="apple-itunes-app" content="app-id=ourAppID">
<meta name="google-play-app" content="app-id=ourAppID">
<?php
$_SESSION['showSmartBanner'] = false;
endif;
?>
It gets the homepage part; it only displays there. But it seems to be ignoring the check for the session variable. I've error logged things out, and even when the session variable is set (indicating that the banner should not show), the banner is still displaying.
The only reason I can think of for this is that the meta tags are being cached. Is there any way to granularly control the caching of meta tags? I don't want to use any of the http-equiv
meta tags, because as far as I can tell that would affect the entire site, not just the individual tags.
If anyone can think of another reason this wouldn't be working, I'm all ears. I've been staring at this for way too long, and may be missing something obvious.