@@ -36,42 +36,61 @@ const config = {
3636 } ,
3737 ...( isProduction
3838 ? [
39- // Ketch consent management script
39+ // Google Consent Mode - Set defaults before Google tags load
4040 {
4141 tagName : "script" ,
4242 attributes : { } ,
43- innerHTML : `!function(){window.semaphore=window.semaphore||[],window.ketch=function(){window.semaphore.push(arguments)};var e=document.createElement("script");e.type="text/javascript",e.src="https://global.ketchcdn.com/web/v3/config/datastax/langflow_org_web/boot.js",e.defer=e.async=!0,document.getElementsByTagName("head")[0].appendChild(e)}();` ,
43+ innerHTML : `
44+ window.dataLayer = window.dataLayer || [];
45+ function gtag(){dataLayer.push(arguments);}
46+
47+ // Set default consent to denied
48+ gtag('consent', 'default', {
49+ 'ad_storage': 'denied',
50+ 'ad_user_data': 'denied',
51+ 'ad_personalization': 'denied',
52+ 'analytics_storage': 'denied'
53+ });
54+ ` ,
4455 } ,
45- // Ketch jurisdiction dynamic link and GA4 consent tracking
56+ // TrustArc Consent Update Listener
4657 {
4758 tagName : "script" ,
48- attributes : {
49- defer : "true" ,
50- } ,
59+ attributes : { } ,
5160 innerHTML : `
52- ;(function () {
53- const onKetchConsentGtagTrack = (consent) => {
54- if (window.gtag &&
55- consent.purposes &&
56- 'analytics' in consent.purposes &&
57- 'targeted_advertising' in consent.purposes
58- ) {
59- const analyticsString = consent.purposes.analytics === true ? 'granted' : 'denied'
60- const targetedAdsString = consent.purposes.targeted_advertising === true ? 'granted' : 'denied'
61- const gtagObject = {
62- analytics_storage: analyticsString,
63- ad_personalization: targetedAdsString,
64- ad_storage: targetedAdsString,
65- ad_user_data: targetedAdsString,
61+ (function() {
62+ function updateGoogleConsent() {
63+ if (typeof window.truste !== 'undefined' && window.truste.cma) {
64+ var consent = window.truste.cma.callApi('getConsent', window.location.href) || {};
65+
66+ // Map TrustArc categories to Google consent types
67+ // Category 0 = Required, 1 = Functional, 2 = Advertising, 3 = Analytics
68+ var hasAdvertising = consent[2] === 1;
69+ var hasAnalytics = consent[3] === 1;
70+
71+ gtag('consent', 'update', {
72+ 'ad_storage': hasAdvertising ? 'granted' : 'denied',
73+ 'ad_user_data': hasAdvertising ? 'granted' : 'denied',
74+ 'ad_personalization': hasAdvertising ? 'granted' : 'denied',
75+ 'analytics_storage': hasAnalytics ? 'granted' : 'denied'
76+ });
77+ }
78+ }
79+
80+ // Listen for consent changes
81+ if (window.addEventListener) {
82+ window.addEventListener('cm_data_subject_consent_changed', updateGoogleConsent);
83+ window.addEventListener('cm_consent_preferences_set', updateGoogleConsent);
84+ }
85+
86+ // Initial check after TrustArc loads
87+ if (document.readyState === 'complete') {
88+ updateGoogleConsent();
89+ } else {
90+ window.addEventListener('load', updateGoogleConsent);
6691 }
67- window.gtag('consent', 'update', gtagObject)
68- }
69- }
70- if (window.ketch) {
71- window.ketch('on', 'consent', onKetchConsentGtagTrack)
72- }
73- })()
74- ` ,
92+ })();
93+ ` ,
7594 } ,
7695 ]
7796 : [ ] ) ,
@@ -103,7 +122,7 @@ const config = {
103122 lastmod : "datetime" ,
104123 changefreq : null ,
105124 priority : null ,
106- ignorePatterns : [ "/preferences" ] ,
125+ ignorePatterns : [ ] ,
107126 } ,
108127 gtag : {
109128 trackingID : "G-SLQFLQ3KPT" ,
@@ -146,27 +165,6 @@ const config = {
146165 [ "docusaurus-node-polyfills" , { excludeAliases : [ "console" ] } ] ,
147166 "docusaurus-plugin-image-zoom" ,
148167 [ "./src/plugins/segment" , { segmentPublicWriteKey : process . env . SEGMENT_PUBLIC_WRITE_KEY , allowedInDev : true } ] ,
149- [ "./src/plugins/scroll-tracking" , {
150- segmentPublicWriteKey : process . env . SEGMENT_PUBLIC_WRITE_KEY ,
151- allowedInDev : true ,
152- selectors : [
153- {
154- selector : 'h1, h2, h3, h4, h5, h6' ,
155- eventName : 'Docs.langflow.org - Heading Viewed' ,
156- properties : {
157- element_type : 'heading'
158- }
159- } ,
160- {
161- selector : '.ch-codeblock' ,
162- eventName : 'Docs.langflow.org - Codeblock Viewed' ,
163- properties : {
164- element_type : 'code' ,
165- language : 'helper:codeLanguage'
166- }
167- }
168- ]
169- } ] ,
170168 [
171169 "@docusaurus/plugin-client-redirects" ,
172170 {
@@ -409,26 +407,38 @@ const config = {
409407 className : "header-github-link" ,
410408 target : "_blank" ,
411409 rel : null ,
412- 'data-event' : 'Docs.langflow.org - Social Clicked' ,
413- 'data-platform' : 'github'
410+ 'data-event' : 'UI Interaction' ,
411+ 'data-action' : 'clicked' ,
412+ 'data-channel' : 'docs' ,
413+ 'data-element-id' : 'social-github' ,
414+ 'data-namespace' : 'header' ,
415+ 'data-platform-title' : 'Langflow'
414416 } ,
415417 {
416418 position : "right" ,
417419 href : "https://twitter.com/langflow_ai" ,
418420 className : "header-twitter-link" ,
419421 target : "_blank" ,
420422 rel : null ,
421- 'data-event' : 'Docs.langflow.org - Social Clicked' ,
422- 'data-platform' : 'x'
423+ 'data-event' : 'UI Interaction' ,
424+ 'data-action' : 'clicked' ,
425+ 'data-channel' : 'docs' ,
426+ 'data-element-id' : 'social-twitter' ,
427+ 'data-namespace' : 'header' ,
428+ 'data-platform-title' : 'Langflow'
423429 } ,
424430 {
425431 position : "right" ,
426432 href : "https://discord.gg/EqksyE2EX9" ,
427433 className : "header-discord-link" ,
428434 target : "_blank" ,
429435 rel : null ,
430- 'data-event' : 'Docs.langflow.org - Social Clicked' ,
431- 'data-platform' : 'discord'
436+ 'data-event' : 'UI Interaction' ,
437+ 'data-action' : 'clicked' ,
438+ 'data-channel' : 'docs' ,
439+ 'data-element-id' : 'social-discord' ,
440+ 'data-namespace' : 'header' ,
441+ 'data-platform-title' : 'Langflow'
432442 } ,
433443 ] ,
434444 } ,
@@ -464,7 +474,7 @@ const config = {
464474 {
465475 html : `<div class="footer-links">
466476 <span>© ${ new Date ( ) . getFullYear ( ) } Langflow</span>
467- <span id="preferenceCenterContainer"> · <a href="https://langflow.org/preferences ">Manage Privacy Choices</a></span>
477+ <span id="preferenceCenterContainer"> · <a href="#" onclick="if(typeof window !== 'undefined' && window.truste && window.truste.eu && window.truste.eu.clickListener) { window.truste.eu.clickListener(); } return false;" style="cursor: pointer; ">Manage Privacy Choices</a></span>
468478 </div>` ,
469479 } ,
470480 ] ,
0 commit comments