Setting up Google Analytics for GDPR
Setting up Google Analytics for GDPR#
We are going to check for a cookie named trackMe, if that cookie is null, we will show a popup asking the user if its ok to run GA, if the cookie value is true, we will run the GA script. If it is false, we do not run the GA script.
Step 2a: Remove the GA (analytics) and GTM (tag manager) auto loading
Remove all the GA and GTM script tags stuff from the
loader view file in the editor and save it. If you are using Zesty.io GA auto loader, you need to delete the setting. You can delete the GA settings in config > settings > analytics.
Step 2b: Create an Analytics Loading Function
We will want to setup a function to run Google Analytics, that way we can run it as a user accepts, and run it when we check the
Step 3: Create CSS/HTML popup for unrecognized visits.
In your theme, create a page or panel with language about the cookies and some toggle buttons. You will check a cookie using the
getCookie function to load or not load this.
Step 4: Connect buttons to set a preference on a cookie
Setup on clicks to the buttons that setup a cookie
trackMe to store the user's preference.
Step 5: Check the
If the trackMe cookie is true, we will want to run the load
Use Google Chrome and download the EditThisCookie plugin. Once installed, a cookie icon will appear on your toolbar. Use that to check if the
trackMe cookie is there, you can also delete the cookie there.
Connect with Content Experts
Book a free 15-minute consultation with a content expert. Discuss your application, pain points and requirements. Understand how Zesty's lower total cost of ownership, features, functionality can elevate your business by creating extraordinary digital experiences.
G2 MOMENTUM LEADER