Google Analytic filtering code breaks enquiry form

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 23, 2011   (RSS)

By jarvis - June 22, 2011

Hi All,

I hope someone can help. Our site has an include file which pulls in an enquiry form. All works fine.

The client then started using email marketing which included google analytic tracking code. Problem was, this wouldn't return a search result as the record name couldn't be recognised due to the additional code in the URL:
?utm_medium=email&utm_campaign=Issue+2&utm_content=Preview&utm_source=EmailMarketingSoftware

Interactive Tools kindly helped us out by adding some filtering code to the templates like so:
<?php

$filtered=array();
$filtered_query="";

//Filter
foreach($_REQUEST as $key=>$value){
switch($key){
//keys to filter out
case "utm_medium":
case "utm_source":
case "utm_content":
case "utm_campaign":
continue;
break;
default:
$filtered[$key]=$value;
$filtered_query.=$key."=".$value."&";
break;
}
}

$temp = $_REQUEST; //store $_REQUEST in a temporary variable $temp_query = $_SERVER['QUERY_STRING'];

//set variables to filtered state
$_REQUEST=$filtered;
$_SERVER['QUERY_STRING']=$filtered_query;


?>

Problem is, it seems to block the $_REQUEST from the enquiry form script. We've done some testing and it's definitely the above block of code causing the issue.

Can anyone see a way around this? Sadly, we've no money in the budget to resolve it :-(

Thanks in advanced

jarvis

Re: [Jason] Google Analytic filtering code breaks enquiry form

By jarvis - June 23, 2011

Hi Jason,

I'll email you rather than post the scripts on the forum.

Thanks,

jarvis