React-ga: Support on Google optimize

Created on 22 May 2017  路  6Comments  路  Source: react-ga/react-ga

The documentation does not mention Google Optimize.
Does the library support it?

Most helpful comment

It's equivalent, just with some checks. ReactGA.ga('require', name, options); is the same as ReactGa.plugin.require(name, options);. (There's extra debugging and checking involved: https://github.com/react-ga/react-ga/blob/master/src/index.js#L362-L405)

As for your other question, I don't think it does load both times as the original ga code will only load one instance (window.ga) so I think only one plugin will be required.

All 6 comments

I would also like to know if google optimize is being supported :) Also would be happy to help if needed

@199911 did you find out yourself ?

I read the documentation
AB test in google optimize seems require user to add a short inline script.
I don't know how to handle it in component aspect

As I posted in #141, does support of Google Optimize require anything beyond using this https://github.com/react-ga/react-ga#reactgapluginrequirename-options?
Docs I was reading for this is: https://support.google.com/360suite/optimize/answer/6262084#example-combined-snippet

Quick question that SimeonC. I managed to get Google Optimize to work by simply using:
ReactGA.ga('require', 'my-id');

What would the benefit be of using the ReactGA.plugin.require(...) api?

And would you know if either of those forces the Google Optimize script to get loaded each time? More specifically, I have two separate modules in my codebase, each which do:

import ReactGA from 'react-ga';
ReactGA.initialize('my-ga-tracker');
ReactGA.ga('require', 'my-google-optimize-id');

Should both modules call the require? Or just one/the first loaded?

It's equivalent, just with some checks. ReactGA.ga('require', name, options); is the same as ReactGa.plugin.require(name, options);. (There's extra debugging and checking involved: https://github.com/react-ga/react-ga/blob/master/src/index.js#L362-L405)

As for your other question, I don't think it does load both times as the original ga code will only load one instance (window.ga) so I think only one plugin will be required.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

velchevski picture velchevski  路  3Comments

amcinerneynewf picture amcinerneynewf  路  4Comments

andrewmclagan picture andrewmclagan  路  3Comments

achhranitesh picture achhranitesh  路  3Comments

dirtyredz picture dirtyredz  路  7Comments