PageSourceSearch

https://jcdn.toastmasters.org//Content/Scripts/cookieconsent-config.js?t=639233504942968547

js toastmasters.org collected 2026-09-24 06:48:16 UTC 12,006 bytes, 321 lines download raw bytes

1import '/Content/Scripts/cookieconsent.umd.js';
2
3window.COOKIE_CONFIG = {
4    enabled: window.COOKIE_CONSENT_ENABLED,
5    forceConsent: true,
6    expirationDays: 365,
7
8    services: {
9        googleAnalytics: {
10            id: 'G-85MP19V9HQ',
11            num: '85MP19V9HQ',
12            enabled: false
13        },
14        sitecore: {
15            enabled: false
16        },
17        fullStory: {
18            enabled: false,
19            beforeEnabled : false
20        }
21    }
22};
23
24const ServiceManager = {
25    enableGoogleAnalytics: function () {
26        if (!window.COOKIE_CONFIG.services.googleAnalytics.id) return;
27
28        if (typeof gtag !== 'undefined') {
29            gtag('consent', 'update', {
30                'analytics_storage': 'granted'
31            });
32        }
33
34        window['ga-disable-' + window.COOKIE_CONFIG.services.googleAnalytics.id] = false;
35        if (typeof ga !== 'undefined') {
36            ga('create', 'UA-3544692-1', 'auto');
37            ga('send', 'pageview');
38        }
39        window.COOKIE_CONFIG.services.googleAnalytics.enabled = true;
40    },
41
42    disableGoogleAnalytics: function () {
43        if (window.COOKIE_CONFIG.services.googleAnalytics.id) {
44            window['ga-disable-' + window.COOKIE_CONFIG.services.googleAnalytics.id] = true;
45        }
46        CookieUtils.deleteCookie('_ga');
47        CookieUtils.deleteCookie('_gid');
48        CookieUtils.deleteCookie('_gat');
49        CookieUtils.deleteCookie('_ga_' + window.COOKIE_CONFIG.services.googleAnalytics.num);
50        CookieUtils.deleteCookie(null, '_ga');
51
52        window.COOKIE_CONFIG.services.googleAnalytics.enabled = false;
53    },
54
55    enableSitecoreAnalytics: function () {
56        window.COOKIE_CONFIG.services.sitecore.enabled = true;
57        $.ajax({
58            url: '/api/sitecore/TrackingConsent/EnableTracking',
59            type: 'POST',
60            dataType: 'json',
61            success: function (response) {
62                if (response.success) {
63                    console.log('Tracking enabled');
64                }
65            },
66            error: function (xhr, status, error) {
67                console.error('Error enabling tracking:', error);
68            }
69        });
70    },
71
72    disableSitecoreAnalytics: function () {
73        CookieUtils.deleteCookie('sc_analytics_global_cookie');
74        CookieUtils.deleteCookie('SC_ANALYTICS_GLOBAL_COOKIE');
75        window.COOKIE_CONFIG.services.sitecore.enabled = false;
76        $.ajax({
77            url: '/api/sitecore/TrackingConsent/DisableTracking',
78            type: 'POST',
79            dataType: 'json',
80            success: function (response) {
81                if (response.success) {
82                    console.log('Tracking disabled');
83                }
84            },
85            error: function (xhr, status, error) {
86                console.error('Error disabling tracking:', error);
87            }
88        });
89    },
90    enableFullStory: function () {
91        window.COOKIE_CONFIG.services.fullStory.enabled = true;
92        if (typeof FS !== 'undefined' && window.COOKIE_CONFIG.services.fullStory.beforeEnabled == false) {
93            window.COOKIE_CONFIG.services.fullStory.enabled = true;
94            FS('start');
95            FS('setIdentity', { consent: true });
96        }
97        else if (typeof FS !== 'undefined' && window.COOKIE_CONFIG.services.fullStory.beforeEnabled == true) {
98            try {
99                FS.restart();
100                FS('setIdentity', { consent: true });
101            } catch (e) {
102                console.log('FS restart failed:', e);
103            }
104        }
105    },
106
107    disableFullStory: function () {
108        if (typeof FS !== 'undefined') {
109            try {
110                FS('setIdentity', { consent: false });
111                FS.shutdown();
112            } catch (e) {
113                console.log('FS shutdown failed:', e);
114            }
115        }
116        CookieUtils.deleteCookie('fs_uid');
117        CookieUtils.deleteCookie('fs_cid');
118        CookieUtils.deleteCookie('fs_lua');
119
120        window.COOKIE_CONFIG.services.fullStory.enabled = false;
121    }
122};
123
124const CookieUtils = {
125    deleteCookie: function (name, prefix) {
126        const host = location.hostname;
127
128        const parts = host.split('.');
129        const rootDomain = parts.slice(-2).join('.'); 
130        const parentDomain = parts.slice(-3).join('.');
131
132        const domains = [
133            host,
134            '.' + host,
135            parentDomain,
136            '.' + parentDomain,
137            rootDomain,
138            '.' + rootDomain,
139            'toastmasters.org',
140            '.toastmasters.org'
141        ];
142
143        const paths = ['/', location.pathname];
144
145        const allCookies = document.cookie.split(';').map(c => c.split('=')[0].trim());
146
147        const cookiesToDelete = prefix
148            ? allCookies.filter(c => c.startsWith(prefix))
149            : [name];
150
151        cookiesToDelete.forEach(cookieName => {
152            domains.forEach(domain => {
153                paths.forEach(path => {
154                    document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=${path}; domain=${domain};`;
155                });
156            });
157
158            // Also attempt deletion without specifying domain (host-only cookies)
159            paths.forEach(path => {
160                document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=${path};`;
161            });
162        });
163    }
164}
165
166
167const cookieConsentConfig = {
168    disablePageInteraction: 'true',
169    cookie: {
170        name: 'cookieBannerConsents',
171        domain: location.hostname,
172        path: '/',
173        expiresAfterDays: 365,
174        sameSite: 'Lax'
175    },
176
177    guiOptions: {
178        consentModal: {
179            layout: 'box',
180            position: 'bottom left',
181            equalWeightButtons: true,
182            flipButtons: false,
183            transition: 'slide'
184        },
185        preferencesModal: {
186            layout: 'box',
187            position: 'right',
188            equalWeightButtons: true,
189            flipButtons: false
190        }
191    },
192
193    categories: {
194        necessary: {
195            enabled: true,
196            readOnly: true
197        },
198        analytics: {
199            enabled: false,
200            readOnly: false
201        },
202        marketing: {
203            enabled: false,
204            readOnly: false
205        }
206    },
207    services: {
208        google_analytics: {
209            label: 'Google Analytics',
210            onAccept: () => ServiceManager.enableGoogleAnalytics(),
211            onReject: () => ServiceManager.disableGoogleAnalytics(),
212            cookies: ['_ga', '_gid', '_gat']
213        },
214        sitecore_analytics: {
215            label: 'Sitecore Analytics',
216            onAccept: () => ServiceManager.enableSitecoreAnalytics(),
217            onReject: () => ServiceManager.disableSitecoreAnalytics(),
218            cookies: ['sc_analytics_global_cookie', 'SC_ANALYTICS_GLOBAL_COOKIE']
219        }
220    },
221    language: {
222        default: 'en',
223        autoDetect: 'browser',
224        translations: {
225            en: {
226                consentModal: {
227                    title: 'We use cookies',
228                    description: 'We use cookies to enhance your browsing experience, analyze site traffic, and personalize content. By clicking "Accept All", you consent to our use of cookies.',
229                    acceptAllBtn: 'Accept All',
230                    acceptNecessaryBtn: 'Accept Necessary',
231                    showPreferencesBtn: 'Customize',
232                    footer: '<a href="/footer/cookie-policy">Cookie Policy</a> <a href="/footer/privacy-policy">Privacy Policy</a>'
233                },
234                preferencesModal: {
235                    title: 'Cookie Preferences',
236                    acceptAllBtn: 'Accept All',
237                    acceptNecessaryBtn: 'Accept Necessary',
238                    savePreferencesBtn: 'Save Preferences',
239                    closeIconLabel: 'Close',
240                    sections: [
241                        {
242                            title: 'Cookie Usage',
243                            description: 'Cookies are small files of letters and numbers stored on your browser or device that enable the cookie owner to recognize the device when it visits websites or uses online services. The website you visit may set cookies directly, known as first-party cookies, or may trigger cookies set by other domain names, known as third-party cookies. While we may automatically use some cookies that are strictly necessary to provide the services you request or enable communications, we request your consent for all of our other cookie uses.'
244                        },
245                        {
246                            title: 'Strictly Necessary Cookies',
247                            description: 'Our website requires the use of these cookies to properly operate or provide necessary functions relating to the services you request. They include, for example, cookies enabling you to securely log into our website, use a shopping cart, or purchase products.',
248                            linkedCategory: 'necessary'
249                        },
250                        {
251                            title: 'Analytical/Performance Cookies',
252                            description: 'These cookies allow us and our third-party service providers to recognize and count the number of visitors and to see how visitors move around our website when they are using it. This helps us improve how our website works by, for example, ensuring that users can easily find what they need on our website. These 
252cookies generate aggregate statistics that are not associated with an individualized profile.',
253                            linkedCategory: 'analytics'
254                        }
255                    ]
256                }
257            }
258        }
259    },
260    onFirstConsent: function ({ cookie }) {
261        if (cookie.categories.includes('analytics') && window.gtag) {
262            gtag('event', 'cookie_consent_first', {
263                'event_category': 'cookie_consent',
264                'categories': cookie.categories.join(',')
265            });
266        }
267    },
268
269    onConsent: function ({ cookie }) {
270        if (cookie.categories.includes('analytics')) {
271            ServiceManager.enableGoogleAnalytics();
272            ServiceManager.enableSitecoreAnalytics();
273            ServiceManager.enableFullStory();
274        } else {
275            ServiceManager.disableGoogleAnalytics();
276            ServiceManager.disableSitecoreAnalytics();
277            ServiceManager.disableFullStory();
278        }
279    },
280
281    onChange: function ({ cookie, changedCategories }) {
282        changedCategories.forEach(category => {
283            if (cookie.categories.includes(category)) {
284                switch (category) {
285                    case 'analytics':
286                        ServiceManager.enableGoogleAnalytics();
287                        ServiceManager.enableSitecoreAnalytics();
288                        ServiceManager.enableFullStory();
289                        break;
290                }
291            } else {
292                switch (category) {
293                    case 'analytics':
294                        ServiceManager.disableGoogleAnalytics();
295                        ServiceManager.disableSitecoreAnalytics();
296                        ServiceManager.disableFullStory();
297                        break;
298                }
299            }
300        });
301    }
302};
303
304if (document.readyState === 'loading') {
305    document.addEventListener('DOMContentLoaded', initializeCookieConsent);
306} else {
307    initializeCookieConsent();
308}
309
310function initializeCookieConsent() {
311    CookieConsent.run(cookieConsentConfig);
312}
313document.getElementById('changeCookiePreferences').addEventListener('click', function (e) {
314    e.preventDefault();
315    if (window.CookieConsent && typeof window.CookieConsent.show === 'function') {
316        // Opens the main banner with Accept All / Accept Necessary / Customize
317        CookieConsent.show(true)
318    } else {
319        console.warn('CookieConsent not initialized yet');
320    }
321});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.