Prior consent on Shopify
I am trying to enable the prior consent on my Shopify store, but I have no clue where to find the code, I need to edit. Is it in the "theme.liquid"? Or where??
Kind regards,
Katrine
-
Hi Katrine,
You could enable prior consent by modifying specific code/script and adding cookieconsent attributes to it. For example, the Google Analytics script should be changes from this:
$javascript .= "<script type=\"text/javascript\">
to this:
$javascript .= "<script type=\"text/plain\" data-cookieconsent=\"statistics"\>
You could find more detailed information about how to implement prior consent on Shopify here: https://support.cookiebot.com/hc/en-us/articles/360006184253-Shopify-installation
By adding this cookieconsent attribute to the script and assigning it to specific cookie category, you make sure that the cookies are hold back until the user agrees to them by giving an appropriate consent.
However, if you could tell me to which script/tool you would like to enable prior consent I can be more specific and give you exact guidelines how you could achieve your goal. From your question so far is not clear which code you are searching for and to what you would like to enable prior consent. Also you will need to assign the cookies to appropriate categories.
Basically, you would need to adddata-cookieconsent="statistics/marketing/preferences"
to the script.Regards,
Spas0 -
Thank you for your reply. It does not answer my question though, but I will try to be more specific. I am following this guide (https://support.cookiebot.com/hc/en-us/articles/360006184253-Shopify-installation), and I am working on step 2: implementing prior consent on Shopify. My question is WHERE do I find the code I need to edit? I get that I need to change
$javascript .= "<script type=\"text/javascript\">
to this:$javascript .= "<script type=\"text/plain\" data-cookieconsent=\"statistics"\>
But where do I change it?
Regards,
Katrine
0 -
Hi Katrine,
Usually the code/script should be added by you and all you need to do after Cookiebot integration on the site is not add the cookieconsent attribute. I asked for more detailed information because I wanted to know to which code you would like to enable prior consent (Google Analytics, YouTube video etc).
For example, Google Analytics code/script could be found in the admin panel under Online Store - Preferences - Google Analytics section.Regards,
Spas0 -
Hi Spas,
Thank you once again for your reply. Maybe I have misunderstood - I thought to edit the code of all cookies?? Is it only Google Analytics I need to edit?
Regards,
Katrine
0 -
Hi Katrine,
As I mentioned above, in order to enable prior consent to your website you should add
data-cookieconsent="statistics/marketing/preferences"
to the external scripts that are using cookies.
All other cookies you just need to assign them into appropriate category, so they could be loaded depending on user's preferences and allowed cookie categories.
It is not only Google Analytics that you would need to edit, I just gave it as an example of how and where it should be done. You could not edit the code of all cookies on your website because most of them could be loaded from plugins, modules or the website itself.
Briefly, you should find the external scripts which you are using on the website and modify them by adding cookievonsent attribute and assign cookies to specific cookie category.Regards,
Spas0 -
Hello,
In regards to your comment about editing the Google Analytics script in Online Store - Preferences - Google Analytics, how would we go about and doing that? Would we be adding something into the additional scripts area since the setup is just adding your account?
Regards,
Lauren
0 -
Hi Lauren,
In order to implement and enable prior consent you would need to add '
data-cookieconsent
' attribute to the external script which are setting cookies on your website. Following this path Online Store - Preferences - Google Analytics you could access the Google Analytics script which you would need to modify.
For example, to enabling prior consent on GA script you need to adddata-cookieconsent="statistics"
to the original script.Regards,
Spas0 -
Hi Spas,
On that page there is no option to edit the script. I am only adding the ID for my account.
Regards,
Lauren0 -
Hi Lauren,
In case that you could not modify the Google Analytics script from the admin panel, I guess that you could edit it through the source code of the website. Just find from where the GA script has been called and modify it.
All you would need to do is to add data-cookieconsent attribute to the script.Regards,
Spas0 -
Spas – vConnect – Community Supporter
Just to be sure. I want to my google analytics code to be prior to consent.
I entered my google analytics code in Online Store - Preferences - Google Analytics ---> <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-x"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxxxx-x');
</script>My question is do I add "
data-cookieconsent="statistics"
into the first <script </script(one mentioned bellow) or into section called "Add custom JavaScript to Google Analytics"
Please advise,
thank you
0 -
mentioned above*
Katrine Loug Jagd
Lauren Furumoto
Have you figured it out?
0 -
Hi Petar,
You should add
data-cookieconsent="statistics"
attribute to your google analytics code mentioned above. You could find more detailed information about this here: https://www.cookiebot.com/en/manual-implementation/ under step 4 - Mark up cookie-setting script tags on your website to control cookies.Regards,
Spas0
Please sign in to leave a comment.
Comments
12 comments