Google analytics SyntaxError:意外的标识符。谷歌电子商务跟踪代码的谷歌Chrome调试器
google chrome调试器在以下GA电子商务跟踪代码中显示SyntaxError:意外标识符:Google analytics SyntaxError:意外的标识符。谷歌电子商务跟踪代码的谷歌Chrome调试器,google-analytics,Google Analytics,google chrome调试器在以下GA电子商务跟踪代码中显示SyntaxError:意外标识符: <?php if($this->tx_id == true && $this->rd['total'] == true) { ?> _gaq.push(['_addTrans', <?=$this->tx_id ?>, '',
<?php
if($this->tx_id == true && $this->rd['total'] == true) {
?>
_gaq.push(['_addTrans',
<?=$this->tx_id ?>,
'',
<?=$this->rd['total']?>,
'',
'',
'',
'',
''
]);
<!------Items purchased------>
<?php
foreach($this->dd as $sku=>$val) {
$i++;
$product_title= $this->pp[$sku]['title'];
$qty = $val['pt']['qty'];
?>
_gaq.push(['_addItem',
<?= $this->tx_id ?>,
<?= $sku ?>,
<?= $this->pp[$sku]['title'] ?>,
'',
<?= $this->pp[$sku]['price']?>,
<?= $qty ?>
]);
<?php
}
?>
_gaq.push(['_trackTrans']);
<?php
}
?>
您是否能够提供帮助?您缺少ga\u addTrans和\u addItem命令参数周围的单引号 应该是这样写的:
<?php
if($this->tx_id == true && $this->rd['total'] == true) {
?>
_gaq.push(['_addTrans',
'<?=$this->tx_id ?>', /* <-- Surrounded with single quotes */
'',
'<?=$this->rd['total']?>', /* <-- Surrounded with single quotes */
'',
'',
'',
'',
''
]);
<!------Items purchased------>
<?php
foreach($this->dd as $sku=>$val) {
$i++;
$product_title= $this->pp[$sku]['title'];
$qty = $val['pt']['qty'];
?>
_gaq.push(['_addItem',
'<?= $this->tx_id ?>', /* <-- Surrounded with single quotes */
'<?= $sku ?>', /* <-- Surrounded with single quotes */
'<?= $this->pp[$sku]['title'] ?>', /* <-- Surrounded with single quotes */
'',
'<?= $this->pp[$sku]['price']?>', /* <-- Surrounded with single quotes */
'<?= $qty ?>' /* <-- Surrounded with single quotes */
]);
<?php
}
?>
_gaq.push(['_trackTrans']);
<?php
}
?>