Issue
The library react-ga is available for React platform, its a wrapper for Google Analytics, is there a way to get it to work with the JS SDK integration with GA?
Root cause
Yes, it is possible to integrate Javascript SDK with recat-ga library. Based on the docs for react-ga lib and there is an API to add third party plugins, see example code below:
// Adding trafficType and integrations parameters in Split config:
const sdkConfig = {
core: {
authorizationKey: 'SDK API KEY',
key: 'react-guy',
trafficType: 'account'
},
debug: true,
integrations: [{
type: 'GOOGLE_ANALYTICS_TO_SPLIT'
}]
};
// Initializing ReactGA
ReactGA.initialize('UA-xxxxxxxx-1');
ReactGA.plugin.require('splitTracker');
ReactGA.pageview(window.location.pathname);
Comments
0 comments
Please sign in to leave a comment.