3

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!

Community
  • 1
  • 1
Martin Nordström
  • 5,779
  • 11
  • 30
  • 64
  • 1
    How long have you waited? Can you post an output from the network tab? – XTOTHEL Nov 26 '19 at 20:42
  • 1
    @XTOTHEL Yes, so that was the problem. I didn't wait long enough for the reports to be generated. This is not related to my original question, but since I saw "Web Analytics" in your profile bio.. Do you perhaps know how to create a custom report that will filter out duplicated transaction ids? – Martin Nordström Nov 26 '19 at 22:39

0 Answers0