Jump to content

Firstep

Circle Member
  • Posts

    3
  • Joined

  • Last visited

1 Follower

Personal Information

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Firstep's Achievements

  1. Big thank you to @Parker_SQSP for the code above. I've got absolutely no idea when it comes to Javascript but I've adjusted it slightly and could do with someone sense-checking what I've done... 1. Using GTM code instead of Google Ads Tag ID I guess in @Parker_SQSP's code you're supposed to replace the two AW-{AW-ID}'s with a relevant Google Ads Tag ID? Instead I put my Google Tag Manager GTM container ID, and it still appears to work. Is that to be expected? 2. Adding "analytics_storage" I noticed that using @Parker_SQSP's code would result in analytics_storage being granted on page load before consent had been given. So I added values for analytics_storage alongside the others in several places throughout the code. And this now appears to work too! Again, is this to be expected? And am I right to want the default behaviour of analytics_storage to be Denied until consent it is given via a cookie banner? I've been testing it out in Tag Assistant and everything appears to be working correctly. Cookie Consent State (gcs) is set to G100 (No consent) on page load, and switches to G111 (Ads & Analytics have consent) after consent is given. Here is the butchered code that I have produced... <script async src="https://www.googletagmanager.com/gtag/js?id=GTM-XXXXXXX"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('consent', 'default', { 'ad_storage': 'denied', 'analytics_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied' }); gtag('js', new Date()); gtag('config', 'GTM-XXXXXXX'); let squarespaceCookies = {}; if (window.getSquarespaceCookies) { squarespaceCookies = window.getSquarespaceCookies(); } const consentValue = squarespaceCookies.marketing === 'accepted' ? 'granted' : 'denied'; const consentObj = { 'ad_storage': consentValue, 'analytics_storage': consentValue, 'ad_user_data': consentValue, 'ad_personalization': consentValue }; gtag('consent', 'update', consentObj); window.onCookieBannerInteraction = () => { let squarespaceCookies = {}; if (window.getSquarespaceCookies) { squarespaceCookies = window.getSquarespaceCookies(); } const consentValue = squarespaceCookies.marketing === 'accepted' ? 'granted' : 'denied'; const consentObj = { 'ad_storage': consentValue, 'analytics_storage': consentValue, 'ad_user_data': consentValue, 'ad_personalization': consentValue }; gtag('consent', 'update', consentObj); } </script> And I don't understand how @Alisonsmith12's code above integrates into this and what it does?
  2. How did this go @TimWilson ? I'm trying to do something almost identical.
  3. I just wanted to say a big thanks to @creedon for this. It has lifted my Category and Tag pages, and will really help the site's SEO too! https://www.firstep.co.uk/work/category/Web+Design One problem I had with the latest version is that it caused the first blocks of text on the main article pages to disappear. I fixed this by pasting the code into a Code block at the bottom of the Category page, rather than the Header Code Injection that is applied to all blog pages.
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.