Thanks Joss,
So I placed this in my _init.php file, which makes it global and available throughout the site:
if($input->urlSegment1) {
$localpath = str_replace("","","$input->urlSegment1");
}else{
$localpath = "";
}
Now, in my top nav and footer menu, I place "$localpath" first after href=' :
$homepage = $pages->get('/');
$children = $homepage->children();
foreach($children as $child) {
if($child->id == $page->rootParent->id) {
echo "<li class='current'><a href='$child->url$localpath'>$child->title</a></li>";
echo "<li class='divider'></li>";
} else {
echo "<li><a href='$child->url$localpath'>$child->title</a></li>";
echo "<li class='divider'></li>";
}
}
For my top and footer logo links to home:
<a href="/<?php echo $localpath; ?>"
All works perfect. Now I can use Hanna Code to serve up local content for area specific AdWords campaigns.