[英]Google analytics not tracking enhanced ecommerce Data
我管理着數家酒店進行分析,實際上擁有400家,我們正在將電子商務數據更新為增強型電子商務。
當我將腳本更新為100家酒店的電子商務時,沒有人在工作,因此我進行了測試,發現沒有實施isogram分析代碼,並解決了現在有70/100家酒店正在獲取電子商務數據的問題。
idk如果花時間來獲取最近30家酒店的數據,但這是代碼,如果有人看到錯誤,謝謝。
<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', 'viewcode', 'auto', {'allowLinker': true});
// Load the plugin.
ga('require', 'linker');
// Define which domains to autoLink.
ga('linker:autoLink',['websites']);
ga('send', 'pageview');
ga('require', 'ec');
ga('set', '&cu', 'MXN');
ga('ec:addProduct', {
'id': '{SkuCode}',
'name': '{ProductName}',
'category': '{Category}',
'price': '{UnitPrice}',
'quantity': {Quantity}
});
ga('ec:setAction', 'purchase', {
id: '{NoReservation}',
revenue: '{Total}',
tax: '{Tax}'
});
ga('send', 'event');
</script>
您正在使用的分析代碼看起來不錯,但是為了確保從所有酒店網站推送分析代碼,我建議您遵循以下步驟:
1)檢查“鏈接器”參數中的酒店域名是否正確
2)確認這些網站沒有其他GA分析代碼會覆蓋您的代碼。 為了避免沖突,我建議您將“ ga”全局對象重命名為“ myga”或類似的名稱。 例:
<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','myga');
myga('create', 'viewcode', 'auto', {'allowLinker': true});
// Load the plugin.
myga('require', 'linker');
// Define which domains to autoLink.
myga('linker:autoLink',['websites']);
myga('send', 'pageview');
...
如果您在GA信息中心中使用GA Real-time,則可以檢查酒店何時推送事件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.