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: [jarvis] Google Analytic filtering code breaks enquiry form

By Jason - June 22, 2011

Hi Jarvis,

Okay, just to make sure I understand, your saying that the code above is removing the data input into your form?

If so, where does this filtering code appear? Is it in the include file, or in the including file?

Let me know, also, if you could attach both the main file and the include file I can take a look and give you some suggestions.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/