Articles on: Frequently Asked Questions (FAQ)

Google Analytics 4 (GA4) integration for Consentmo GDPR app

The integration will be done with an additional script. The script below will block Google Analytics 4 based on a Global Tag.

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

Enabling of the Google Analytics 4's integration script

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

Copy the content of the file provided below and paste it under the script tags from step 5. Afterward, follow the next three steps:

Download Google Analytics 4 (GA4) Integration script

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

* Step 2. Copy the content of the Google Analytics 4 script and paste it under the comments “// The content of the Google Analytics 4 script goes here”.

* Step 3. Comment out or delete the Google Analytics 4 scripts and save the changes.

The final result should look like this:

That's it!

Updated on: 22/08/2023

Was this article helpful?

Share your feedback


Thank you!