I am using the React-GA library for sending analytics to Google Analytics.
I've managed to set it up for pageviews and event tracking, but I'd also like it to work with eCommerce. I am fairly new to this, but I've figured out this:
- I need to activate the eCommerce option on Google Analytics, which I've done.
- When sending transaction data with this lib, I have to do something similar to this, this.
So my code looks like this at the moment:
ReactGA.plugin.require("ecommerce");
ReactGA.plugin.execute("ecommerce", "addTransaction", {
id: webPaymentResponse.transactionId,
revenue: "10.00"
});
ReactGA.plugin.execute("ecommerce", "addItem", {
id: webPaymentResponse.transactionId,
name: "Product Name",
price: "10.00",
category: "Food",
quantity: "1"
});
ReactGA.plugin.execute("ecommerce", "send", null);
ReactGA.plugin.execute("ecommerce", "clear", null);
And I can see in the network tab that it's sending my request to Google Analytics, but when I check my eCommerce tab I see no transactions at all.
I am also initilizing ReactGA in the root of the project like so:
ReactGA.initialize({
trackingId: "...",
debug: true,
gaOptions: {
cookieDomain: "none"
}
});
So if any Analytics people could give me some directions I'd be more than happy. Since I'm really stuck right now.
Thanks!