Google Optimize + Ghost

How to use Ghost and Google Optimize together

Run experiments on your Ghost site to improve the experience for your visitors and increase conversions

Google Optimize is a free tool that allows website owners to run experiments to test the overall visitor experience and make informed decisions about their website. Whether you need to test a home page design, different value propositions or the performance of a call-to-action, Google Optimize allows you to do that with A/B tests, multivariate tests and more.

Google Optimize is a free solution to run experiments on your site and is suitable for site owners who are also using Google Analytics on their Ghost publication. The following guide explains how to install Optimize so you can get started with your own experiments.


It’s recommended to use the optimize.js (async) installation method, since this version has the least impact on your website’s rendering speed. For further information about installation methods, follow the install guide.

Before installing the optimize.js script on your Ghost site, ensure the following prerequisites are in place:

  1. You have a Google Analytics property and have integrated this with your Ghost site
  2. You have created an Optimize account from your Google account, and linked your Optimize with your Google Analytics property

Install optimize.js

To install Optimize, copy the following code, replacing OPT_CONTAINER_ID with your Optimize container ID:

<script async src=""></script>

Then paste it into the very top of the Site Header of code injection in Ghost Admin:

code injection Ghost

[Optional] Install the anti-flicker snippet

Page flicker – also known as JavaScript flicker or DOM flicker occurs when a browser engine renders a web page before all of information is retrieved. If you notice flicker when using Google Optimize, you should ensure the Optimize snippet is at the very top of the Site heading section in code injection, or for an advanced solution install the anti-flicker snippet.

Create your first experiment

Once Optimize is installed on your publication, get started with a brand new A/B test or any other type of experiment.

code injection Ghost

Once you’ve created an experiment, you use the Optimize installation in the settings to test your installation is working, by clicking the Check installation button.

code injection Ghost

For more information about setting up experiments and using the Google Optimize dashboard, visit the Optimize Resource Hub.