美好的一天,
我正在尝试跟踪来自我们网站的电子商务数据。我们有一个登台站点,已成功将电子商务数据发送到GA。我们已经将代码从登台站点复制到了实时站点,但是我们没有从实时站点获取电子商务数据。两个网站都使用相同的Google Analytics(分析)帐户,但是两个网站都有各自的GTM帐户。
ga( 'send', 'pageview' );
});</script> <script id=slb_context>if ( !!window.jQuery ) {(function($){$(document).ready(function(){if ( !!window.SLB ) { {$.extend(SLB, {"context":["public","user_guest"]});} }})})(jQuery);}</script> <script>$(document).ready(function() {
$('map').off().imageMapResize();
});</script> <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-WR6BK29" height=0 width=0 style=display:none;visibility:hidden></iframe></noscript> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WR6BK29');</script> <script>window.addEventListener('load',function(){
if(window.location.pathname.indexOf('thank-you-purchase')!=-1){
gtag('event', 'purchase', {
"transaction_id": jQuery('.order_id').text(),
"affiliation": "cleanaway",
"value": parseFloat(jQuery('.price').text().replace(/[^0-9.]/g,'')),
"currency": "AUD",
"tax": parseFloat(jQuery('.tax').text().replace(/[^0-9.]/g,'')),
"shipping": parseFloat(0),
"items": [
"brand": "MyBrand",
"category": "",
"variant": "",
"list_position": '',
"quantity": 1,
"price":jQuery('.order_id').text().replace(/[^0-9.]/g,'')
}
]
});
}
})</script>