Skip to content

Bare-bones integration of Google Optimize w/Gatsby. Meant to be bare minimum to allow marketers to begin doing A/B tests, a more thorough integration would solve most of the issues in this example.

Notifications You must be signed in to change notification settings

gatsby-sales/google-optimize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gatsby

Google Optimize w/Gatsby

Example site

A simple example of using Google Optimize A/B tests in a Gatsby site.

Using Optimize in your Gatsby pages should be done on a per-page basis, moreso where the A/B test is happening on the page determines how you should approach it, specifically 'above-the-fold' vs 'below-the-fold'. The main differentiator: for 'above-the-fold' you need the 'anti-flicker' script provided by optimize.

index.tsx has the scripts to run optimize. The 'anti-flicker' script imo is a super hacky workaround for above-the-fold A/B tests where the starting HTML would be apparent before React hydrates; it includes a timeout that should be set as low as possible. For all other tests the 'anti-flicker' script should be removed.

🚀 Quick start (Gatsby Cloud)

Deploy this starter with one click on Gatsby Cloud:

Deploy to Gatsby Cloud

About

Bare-bones integration of Google Optimize w/Gatsby. Meant to be bare minimum to allow marketers to begin doing A/B tests, a more thorough integration would solve most of the issues in this example.

Resources

Stars

Watchers

Forks