这是我的 php 代码:
<?php
$gaorder="<script type='text/javascript'> ";
$gaorder=$gaorder."var _gaq = _gaq || []; ";
$gaorder=$gaorder."_gaq.push(['_setAccount', 'UA-32542684-1']); ";
$gaorder=$gaorder."_gaq.push(['_trackPageview']); ";
$tax=($totalCost/100)*5;
$gaorder=$gaorder."_gaq.push(['_addTran','".$code_order."','haxata.com','".$totalCost."','".$tax."','0','ThanhPho','Tinh','VietNam']); ";
global $db;
$db->getConnect();
while($row = mysql_fetch_array($result))
{
$gaorder=$gaorder."_gaq.push(['_addItem','".$code_order."','".$row[Product]."','".$row[Name]."','".$row[Name]."','".$row[Cost]."','".$row[Number]."']); ";
}
$db->closeConnect();
$gaorder=$gaorder."_gaq.push(['_trackTrans']); ";
$gaorder=$gaorder."(function() {";
$gaorder=$gaorder."var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ";
$gaorder=$gaorder."ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';";
$gaorder=$gaorder."var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);";
$gaorder=$gaorder."})();";
$gaorder=$gaorder."</script>";
echo $gaorder;
?>
交易 ID 和数量有效!但是税收,运输和收入不起作用!