2012-05-03 3 views
0

グーグルクロームデバッガのためのGoogle ChromeのデバッガにSyntaxErrorを示しています。以下GA eコマーストラッキングコードに予期しない識別子:SyntaxError:予期しない識別子。 Googleのeコマーストラッキングコード

<?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 
} 
?> 

あなたが支援することができますか?

答えて

0

ga _addTrans_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 
} 
?> 

関連する問題