For a landing page campaign we're pulling in some variables from the url. I need a way to check and see if the 'utm_source=' is present in the url and if it is not redirect the user. We only want traffic from our banner ads, which all have Google Analtyics Links (incl. utm_source).
For example the url "http://www.example.com?utm_source=Google&utm_medium=AdWords&utm_term=Foo&utm_campaign=MyCampaign should work but the url "http://www.example.com" should get redirected to another page
<?php
if (isset($_REQUEST['utm_source'])) {
// param was set in the query string
echo('present');
if(empty($_REQUEST['utm_source'])) {
// query string had param set to nothing ie ?param=¶m2=something
echo('missing');
}
}
?>
seems right but isn't working correctly. Is there a better way? thank you.