2016-09-29 70 views
0

我們的付款流程剛剛移至單頁應用程序,因此我們需要調整我們向Google Analytics發送增強型電子商務數據的方式。在交換機之前,我們正在收到電子商務數據。增強型電子商務,單頁應用程序和代碼管理器

我們的Google Analytics(分析)代碼是通過跟蹤代碼管理器注入的,我們嘗試使用虛擬網頁網址發送渠道數據,但尚未成功。

什麼是最好的方式去實現呢?

編輯:我們目前正在努力使通過數據層提供的數據,並且代碼管理調試器中看到它,但它似乎並沒有通過谷歌分析如下

代碼越來越 - 中電子商務數據在漏斗的每個階段發送。

步驟一:

window.dataLayer.push(window.GA_DATA_OBJECT_START); ga('set', 'page', `/profile/?purchaseView=true&product=${this.state.product}`); ga('send', 'pageview');

第二步:

ga('set', 'page', `/profile/?billingConfirmed=true&product=${this.state.product}`); ga('send', 'pageview');

步驟三:

window.dataLayer.push(window.GA_DATA_OBJECT_END); ga('set', 'page', `/profile/?purchaseSuccess=true&product=${this.state.product}`); ga('send', 'pageview');

+0

? – manzapanza

+0

我們正在使用反應 –

+0

你已經看過反應ga? https://github.com/react-ga/react-ga – manzapanza

回答

0

如果一個單頁的應用程序不要使用發送頁面視圖。

​​

另一個例子

window.ga("ec:addProduct", { 
       "id": booking._id,     // Product ID (string). 
       "name": booking.name, // Product name (string). 
       "category": booking.services[0].category,   // Product category (string). 
       "brand": booking.storeTitle,    // Product brand (string). 
       "price": booking.price,     // Product price (currency). 
       "quantity": 1 
      }); 
      window.ga("ec:setAction", "purchase", {   // Transaction details are provided in an actionFieldObject. 
       "id": booking._id,      // (Required) Transaction id (string). 
       "revenue": booking.companyService.actualPrice,      // Revenue (currency). 
       "coupon": booking.coupon     // Transaction coupon (string). 
      }); 
      window.ga("send", "event", "Form", "Submit", "Booking Form"); 

使用這種只爲展示像

window.ga("ec:addImpression", { 
    "id": companyId,     // Product details are provided in an impressionFieldObject. 
    "name": companyInfo.name, 
    "category": companyInfo.category, 
    "list": "Company Info" 
}); 
window.ga("ec:setAction", "detail"); 
window.ga("send", "pageview"); 
您正在使用哪個SPA框架
+0

是否可以通過數據層提供數據?這是我們迄今一直在嘗試的方法(遺憾的是,在原始問題中忘記提及,將會修改) –

相關問題