2016-09-29 75 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

是否可以通过数据层提供数据?这是我们迄今一直在尝试的方法(遗憾的是,在原始问题中忘记提及,将会修改) –

相关问题