닫힌 소스 전자 상거래 플랫폼에서 실행되는 웹 사이트에 Google 애널리틱스 전자 상거래 추적을 추가하는 방법을 살펴 봅니다. 구글이 자신의 도움말 시스템에서 우리에게 예제로이 코드를 준 :Google Analytics 전자 상거래 추적 수정?
<html>
<head>
<title>Receipt for your clothing purchase from Acme Clothing</title>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
'1234', // transaction ID - required
'Acme Clothing', // affiliation or store name
'11.99', // total - required
'1.29', // tax
'5', // shipping
'San Jose', // city
'California', // state or province
'USA' // country
]);
// add item might be called for every item in the shopping cart
// where your ecommerce engine loops through each item in the cart and
// prints out _addItem for each
_gaq.push(['_addItem',
'1234', // transaction ID - required
'DD44', // SKU/code - required
'T-Shirt', // product name
'Green Medium', // category or variation
'11.99', // unit price - required
'1' // quantity - required
]);
_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>
</head>
<body>
Thank you for your order. You will receive an email containing all your order details.
</body>
</html>
이 단지 최종 판매 페이지에 배치 할 것인가 아니면 데이터에 대한 작업을 수행 할 필요가? 이 작업을 한 번도 해 본 적이 없으므로이 사이트는 php/mysql 스크립트에서 실행 중입니다.