Google Optimize Implementation #27251
-
Sorry if this is the incorrect place, I aimed for Discussions, but ended here. I've searched high and low of Google Optimize implementations which of course is going to differ project to project. I've finally found a working combination within my codebase which can be seen below. Plugins that implement Google Tag Manager, Analytics, and Optimize haven't worked and result in an incorrect Optimize installation. Mainly everything is working now, just the anti-flicker snippet is not -- meaning, it's not triggering at all so I get the visual flash of whatever was edited within Optimize. Wondering if anyone has dealt with this sort of issue, thanks! File contents (if changed)
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hey @Kevin-Carlos, I've experimented with a couple different A/B testing options. I haven't found a great way to avoid the anti-flicker myself with Google Optimize though haven't done as much with it as other options. I was concerned mostly with frontend performance degradations from using a JS blocking 3rd party script. I found VWO to be the least impactful on performance and seems to have some cool logic to keep flickers from happening. FWIW my
|
Beta Was this translation helpful? Give feedback.
-
export function onPreRenderHTML({ |
Beta Was this translation helpful? Give feedback.
Hey @Kevin-Carlos, I've experimented with a couple different A/B testing options. I haven't found a great way to avoid the anti-flicker myself with Google Optimize though haven't done as much with it as other options.
I was concerned mostly with frontend performance degradations from using a JS blocking 3rd party script. I found VWO to be the least impactful on performance and seems to have some cool logic to keep flickers from happening.
FWIW my
gatsby-ssr.js
looks like this with Google Optimize. I'd imagine this is close to the most minimal implementation: