Add support for Google Optimize within the Google Analytics plugin #8099
Labels
good first issue
Issue that doesn't require previous experience with Gatsby
help wanted
Issue with a clear description that the community can help with.
Summary
Within the Google Analytics Plugin, there isn't currently a way to specific a Google Optimize container id to allow for easy A/B testing.
Basic example
Here's a link to the Google Optimize recommended setup: https://support.google.com/optimize/answer/6262084?hl=en
This method basically boils down to adding
ga('require', 'GTM-XXXXXX');
where GTM-XXXXXX is the container id. Here's an example of where this line is added:It seems that this could easily be added to the existing google analytics plugin, following the anonymize line:
And would allow for setting this Id in gatsby-config:
Motivation
Adding support for a Google Optimize Id builds on the already existing support for Google Analytics + Google Tag Manager and makes it very simple for users to easily perform complex A/B + multivariate tests on their existing Gatsby sites.
Would be happy to submit a PR with this addition and welcome any feedback beforehand!
The text was updated successfully, but these errors were encountered: