After installing Cookie-Script on your website you might notice a change in Google Analytics counting direct traffic on your website or the number of visitors drops dramatically. This is actually a case with many third-party systems, not just Google Analytics, and depends a lot on your cookie popup settings. But let's start from the beginning.
There are two ways third-party scripts (like Google Analytics) can track a visitor from one page to another with cookies.
Tracking user on third-party domain cookies
In some cases, cookies are placed under a third-party domain (like google.com). Using this method, third-party service providers can track users between different websites. Such cookies cannot be controlled by your website or scripts like Cookie-Script.
We have prepared instructions on how this can be done.
Tracking user with your website domain cookies
In other cases, cookies are placed under your website domain (like example.com). With this method, third-party service providers cannot track users between different websites, only between pages under your domains.
Cookie-Script automatically deletes those cookies if the user hasn't agreed to them.
Why does analytics data mess up?
In case of third-party domain cookies
The third-party script was modified to be included only after the user gave consent. This means the script does not fire if no consent was given, no third-party functionality will be included.
As a result, the number of visitors on your website will drop significantly according to Google Analytics since all cookie rejecting/ignoring visitors won't be counted.
In case of your website domain cookies
This one is a bit more tricky. No third-party scripts are modified, so third-party functionality does fire.
As a result, each new page visit for such users is considered as a fresh new website visitor coming from outside. So if the same user visited 10 different pages on your website, it will be counted as 10 different visitors coming to your website for the first time.
I just want my Google Analytics back!
Well, there is a way around it...
You can always set some third-party cookies (or scripts) as strictly necessary for your website to function. Such cookies won't be deleted and services like Google Analytics will work as usual. However, in this case, it's quite questionable if your website is still compliant with regulations like GDPR since you might need to prove third-party services (like Google Analytics) are strictly necessary for your website.