expand.shine Posted October 14, 2021 Share Posted October 14, 2021 Site URL: https://www.delightedspirit.com I want to prevent ActiveCampaign's site tracking if someone doesn't consent to cookies on my website. I'm following these instructions & I'm now at the last step (#4). I'd like to know if I need to change anything to make it work with Squarespace specifically? Here's their example: // Insert tracking snippet here if (document.cookie.indexOf('accept_cookies') !== -1) { vgo('process', 'allowTracking'); } $('.btn').on('click', function() { var expiration = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 30); vgo('process', 'allowTracking'); document.cookie = 'accept_cookies=1; expires=' + expiration + '; path=/'; }); I'm not even sure how to test if I did this correctly. Link to comment
paul2009 Posted October 14, 2021 Share Posted October 14, 2021 2 hours ago, expand.shine said: I'd like to know if I need to change anything to make it work with Squarespace specifically? To answer your specific question, it would typically require ".sqs-cookie-banner-v2-accept" instead of ".btn" as shown in your question. However, it's worth me pointing out a couple of other things: 1. You're currently using jQuery version 3.3.1 - an old version that has known security vulnerabilities. (read "bad"). It would be best to change this to 3.6.0. For example: <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK" crossorigin="anonymous"></script> 2. Your Squarespace cookie banner only has the 'agree' option shown. For compliance in the EU, you would need to also show the 'disagree' option (it's available in the Squarespace settings). expand.shine 1 Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional. Would you like your customers to be able to mark their favourite products in your Squarespace store? Link to comment
expand.shine Posted October 14, 2021 Author Share Posted October 14, 2021 Thanks @paul2009! I made the changes. What are the integrity & crossorigin elements of the jquery script? Are they required to update the version? I didn't have that part in my original code. Link to comment
paul2009 Posted October 15, 2021 Share Posted October 15, 2021 18 hours ago, expand.shine said: What are the integrity & crossorigin elements of the jquery script? Good question! They are there to protect your visitors and therefore your site. Whenever you add a script to your site from somewhere else (in this case jquery.com), it's good security practice to check that the file is genuine and hasn't been manipulated or changed by someone else. The integrity attribute allows the browser to integrity check the file. If it doesn't pass this check, it won't be loaded, and your visitors won't be harmed. The crossorigin attribute must be present for the integrity check (above) to be performed. I hope this helps. 😀 If this post has helped you, please click a 'Like' or 'Thanks' icon below ⬇️ expand.shine 1 Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional. Would you like your customers to be able to mark their favourite products in your Squarespace store? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment