react-ga4
react-ga4 copied to clipboard
Ecommerce Plugin migration
Hi, first of all, thanks for your job doing this package.
I would like to know of could I migrate the usage for 'ec' plugin from old reactGA.
For example:
ReactGA.plugin.require('ec');
const TRACKERS = [COMPANY_TRACKER, COMMERCE_TRACKER];
TRACKERS.forEach((tracker) => ReactGA.ga(`${tracker}.require`, 'ec'));
// Inside a foreach for products and trackers :
...
ReactGA.plugin.execute(`${tracker}.ec`, 'addToCart', PRODUCT);
...
ReactGA.plugin.execute(`${tracker}.ec`, 'setAction', 'purchase', PURCHASE);
Thank you.