Getting started
- First of all, install and activate the GDPR Cookie Consent plugin.
- From your WordPress dashboard, go to the GDPR Cookie Consent.
Pre-requisite
As a first step, please remove the Google Analytics/ Google tag manager script that are already installed on the site via the site theme header.php file (common method) or via some other plugin like GA Google Analytics or Google Tag Manager for WordPress.
That is, if the script is added via theme, please remove it or if the tracking is implemented via a plugin, please disable that plugin. Then, follow the below steps:
‘Google Analytics’ implementation
- Login to Google Analytics dashboard.
- Click on the Admin link in the left panel.
- Open the Tracking Info link from the Property view and then click the Tracking code.

Copy the entire script from the Website Tracking section to the clipboard.
Sample code:
Sample:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXX-X');
</script>
Then, from your WordPress site admin dashboard:
- Go to GDPR Cookie Consent > Cookie Category view.
- Click on the edit link on whichever category that you need to use to control the Google Analytics tracking. Eg, you can choose Analytics.
- In the category edit page, you will see 2 fields to insert scripts. Paste the script that you copied earlier to either head or body script field based on your preference. In this case of the Google analytics script, you may paste it inside the Head Script field.
You are good to go now. From now onwards the Google Analytics tracking will run only if the visitor enables or accepts the Analytics category.
‘Google Tag Manager’ implementation
- Login to Google Tag Manager dashboard.
- Click on the container(website) that you want to set up.
- Head over to the Admin tab from the top bar > Click on Install Google Tag Manager.

Now, in order to add the scripts to the website:
- Open the WordPress site admin dashboard, go to GDPR Cookie Consent > Cookie Category view.
- Click on the edit link on whichever category that you need to use to control the Google Analytics tracking. Eg, you can choose Analytics.
- You will see a Head Script and Body Script field in the edit page. Copy the scripts from the Install Google Tag Manager screen into the corresponding fields on the category edit page.
That’s it. From now onwards the Google Analytics tracking will run only if the visitor enables or accepts the Analytics category.
- Was this article helpful?
- Yes, thanks!Not really
Comments (4)
snake
September 7, 2022
is it not possible to just disable the cookies rather than the entire script, so at least basic analytics still works.
Mark
October 10, 2022
Hi,
Greetings from Webtoffee!
Our plugin uses a method of script blocking to ensure no cookies are set prior to user consent. This is done by changing the type attribute of the script from tex/javascript to text/plain. Therefore it is not possible for us to change this implementation as our plugin functionality relies on it.
nasser Nabulsi
July 18, 2022
Hi,
Is there a way where an import excel sheet can be used as a “manifest” for group of SKUs published under a single ( product) in a multivendor Woocommece platform. Need the manifest excel sheet to be accessed at UI/under specific product and can be downloaded/opened by any logged in user. Interested in this with any Plan you have. thanks, Nasser
Mark
August 25, 2022
Hi Nasser,
Sorry to let you down, but we don’t have a solution for this requirement and it is not in our plans as well.