ユニバーサルアナリティクスのトラッキングコード、eコマース

NO IMAGE

●ユニバーサルアナリティクスのトラッキングコード
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-xxxxxxxx-x');
ga('send', 'pageview');
</script>

●ユニバーサルアナリティクスのeコマースコード
addItemはアイテム数分繰り返す。
<script>
ga('require', 'ecommerce', 'ecommerce.js');
ga('ecommerce:addTransaction', {
'id': '123456789', // Transaction ID. Required.
'affiliation': 'SHOP-NAME', // Affiliation or store name.
'revenue': '1000', // Grand Total. Required
'shipping': '0', // Tax.
'tax': '0', // Shipping.
});
ga('ecommerce:addItem', {
'id': '123456789', // Transaction ID. Required.
'name': 'ITEM_NAME', // Product name. Required.
'sku': 'ITEM_CODE', // SKU/code.
'category': '', // Category or variation.
'price': '1000', // Unit price.
'quantity': '1', // Quantity.
});
ga('ecommerce:send');
</script>

Google Analyticsカテゴリの最新記事