<!-- Google Code for Purchase Conversion Page -->
<script language="JavaScript" type="text/javascript">
<!--
var google_conversion_id = 1234567890;
var google_conversion_language = "en_US";
var google_conversion_format = "1";
var google_conversion_color = "666666";
if (<? echo $totalValue?>) {
var google_conversion_value = <? echo $totalValue?>
}
var google_conversion_label = "Purchase";
//-->
</script>
<script language="JavaScript"
src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<img height=1 width=1 border=0
src="http://www.googleadservices.com/pagead/conversion/1234567890/?value=<? echo
$totalValue?>&label=Purchase&script=0">
</noscript>
Let's say that
$totalValue = 5689
It means that you receive this:
if (5689) {
var google_conversion_value = 5689}
I do not think that this part of code makes sense. What is the proper syntax for inserting PHP dynamic variable?
if (<? echo $totalValue?>wink {
var google_conversion_value = <? echo $totalValue?>
}
You're having Javascript to do the if condition. Instead have php to do the if condition as follows
<?if ($totalValue ){
echo "var google_conversion_value = $totalValue";
}?>
With this code you would get "var google_conversion_value = 5689" if the totalValue is some number other than 0. Otherwise nothing get's output.
This
if (<? echo $totalValue?>) {
var google_conversion_value = <? echo $totalValue?>
}
causing this
if (5689) {
var google_conversion_value = 5689}
seems to work - I can see 5689 in my reports.
I have also noticed that the default settings (without using PHP variable) is this:
if (1) {
var google_conversion_value = 1;
}