Articles on: Frequently Asked Questions (FAQ)

Google Optimize integration for Consentmo GDPR app

The Google Optimize service is getting very popular among Shopify store owners and developers, which are using it for optimizing and improving the performance and the impact of their marketing campaigns or to simply check which parts of the store need optimizing in regard to user interface and experience.

Optimize uses the power of Analytics to measure your experiments and leverage your Analytics conversions as experiment objectives. Having said that, the Optimize service is another way of tracking that can be implemented in your store, which to some GDPR laws, is something you will need to get the visitor’s consent for first.

By following the below steps, you will be able to apply proper control on this service, which will work in accordance with the choice the visitor is making via the Cookie bar. Respectively, it will be either fired or stay blocked depending on the configuration of the cookies the visitor decides to accept.

The blocking will be done with an additional script. The script below will block the Google Optimize script based on its tag ID

Here is how the script works: Google Optimize will be set based on a condition, that is checking one of the cookies that are set by our app. This cookie is storing information on which cookie group is currently blocked, either based on the initial state of your cookie bar, or the cookie preferences of your customers. When the initial state is set to block the Analytics cookie group, or the customer opts out, the script which is setting the Google Optimize tag will not be executed.

Instructions on how to set Google Optimize blocking script:

Open Shopify Admin.
Click on Online Store link on the left menu bar.
Click on the Actions dropdown button and from there select Edit Code.
A new page will open with a list of files on the left side of the screen. Open the theme.liquid file.
Locate where you have set the Google Optimize script in the head HTML element - <head>. It should look similar to this:

Copy the content of the Google Optimize blocking script provided below

Download - Google Optimize blocking script

and paste it under the script tag from step 5, as shown below. Afterwards, follow the next two steps:

Applying the Google Optimize blocking script

Step 1. Copy the link which is inside the src attribute and replace {{ 'Your src link' }} with the copied link.

Step 2. Comment out or delete the Google Optimize scripts and save the changes.

The final result should look like this:

That's it!

If you need help with the process, don’t hesitate to contact our support team at: or from the "We Are Here" button at the bottom right corner of your browser.

Updated on: 19/12/2023

Was this article helpful?

Share your feedback


Thank you!