react-ga / react-ga

React Google Analytics Module
Other
5.13k stars 445 forks source link

Help with Enhanced Ecommerce #517

Open santiagoprieto opened 2 years ago

santiagoprieto commented 2 years ago

Posting this here as a last resort. I've tried so many things and read GA documentation thoroughly but I can't get Enhanced Ecommerce to show up in my dashboard. Ecommerce is switched on in my GA settings.

Hoping it's something lame that I missed, but open to try anything. Thanks for your help!

Here's my code:

const EC_ACTIONS = {
    viewItem: 'viewItem',
    beginCheckout: 'beginCheckout',
    purchase: 'purchase'
}

export const initializeGA = () => {
  ReactGA.initialize(process.env.GOOGLE_ANALYTICS_ID, {
    debug: process.env.NODE_ENV === 'test',
    testMode: process.env.NODE_ENV === 'test'
  })
}

export const setActionForGoogleAnalytics = (action, product) => {
  ReactGA.plugin.require('ec')
  ReactGA.plugin.execute('ec', 'addProduct', {
    id: product.id,
    name: product.name
  })
  ReactGA.plugin.execute('ec', 'setAction', action, {
    id: product.id
  })
  ReactGA.plugin.execute('ec', 'clear')
}
Gousenfire commented 2 years ago

Did you solved this problem? Because I also can't get the ecommerce events to show in my dashboard

santiagoprieto commented 2 years ago

Did you solved this problem? Because I also can't get the ecommerce events to show in my dashboard

Nope. I haven't. Let me know if you have any luck 💯

snairsumith commented 2 years ago

Any update regarding this issue ?

santiagoprieto commented 2 years ago

Nope. Let me know if you have any luck on this.

felipdc commented 2 years ago

Any update?