google第三方代码跟踪ecshop订单
2010-08-06 14:42 来源:www.chinab4c.com 作者:admin
ecshop订单的流程里面,可以考虑加入一些第三方的订单跟踪代码,多ecshop的流程进行追踪和统计,有利于ecshop网店的运营和销售。下面将结合google第三方跟踪代码来实际的和大家分享如何让代码和ecshop完美整合.
1:index.dwt
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '帐户id']);
_gaq.push(['_setDomainName', '域名']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
2:flow.dwt
<!--------------------google监视------------------>
{if $order_goods_list}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17817658-1']);
_gaq.push(['_trackPageview']);
/*
_gaq.push(['_addItem',
'1234', // order ID - required
'DD44', // SKU/code - required
'T-Shirt', // product name
'Green Medium', // category or variation
'11.99', // unit price - required
'1' // quantity - required
]); */
{foreach from = $order_goods_list item = item_google}
_gaq.push(['_addItem',
'{$order.order_sn}', // order ID - required
'件', // SKU/code - required
'{$item_google.goods_name}', // product name
'{$item_google.cat_name}', // category or variation
'{$item_google.goods_price}', // unit price - required
'{$item_google.goods_number}' // quantity - required
]);
{/foreach}
_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
{/if}
<!--------------------goodle监视------------------>
3:flow.php
/* 提供给google */
$order_goods_list = $db -> getAll("select goods_id ,goods_name ,goods_number ,goods_price from ".$ecs->table('order_goods')." where order_id = '".$order['order_id']."'");
if($order_goods_list){
foreach($order_goods_list as $k => $v){
$order_goods_list[$k]['cat_name'] = $db -> getOne("select c.cat_name from ".$ecs->table('category')."c , ".$ecs->table('goods')." g where g.cat_id = c.cat_id and g.goods_id = '".$v['goods_id']."'");
}
$smarty -> assign('order_goods_list', $order_goods_list);
}
最近更新
常用插件
- ecshop通用红包编码
很多时候,为了结合促销,必须扩展一下ecshop的红包功能。ecshop的红包...
- ecshop购物车功能改进[插件
ecshop购物车功能改进[插件套餐]主要是我们最近开发工作和开发项目中。...
- ecshop分类树中统计商品数
最近忙于开发其他项目,在不少朋友不断要求和催促的情况下,做出了该小...
- ecshop红包修改成满多少减
我们在长期使用ecshop的时候,我们可以发现。ecshop的红包是一个非常强...
- ecshop降价通知登记插件
ecshop降价通知登记插件,主要是为了方便某些客户,对商品价格要求比...