|
1 | 1 | {{#with site.keys.segment}}
|
2 | 2 | <script>
|
3 | 3 | !function(){var i="analytics",analytics=window[i]=window[i]||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","screen","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware","register"];analytics.factory=function(e){return function(){if(window[i].initialized)return window[i][e].apply(window[i],arguments);var n=Array.prototype.slice.call(arguments);if(["track","screen","alias","group","page","identify"].indexOf(e)>-1){var c=document.querySelector("link[rel='canonical']");n.push({__t:"bpc",c:c&&c.getAttribute("href")||void 0,p:location.pathname,u:location.href,s:location.search,t:document.title,r:document.referrer})}n.unshift(e);analytics.push(n);return analytics}};for(var n=0;n<analytics.methods.length;n++){var key=analytics.methods[n];analytics[key]=analytics.factory(key)}analytics.load=function(key,n){var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.setAttribute("data-global-segment-analytics-key",i);t.src="https://cdn.segment.com/analytics.js/v1/" + key + "/analytics.min.js";var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r);analytics._loadOptions=n};analytics._writeKey="{{this}}";;analytics.SNIPPET_VERSION="5.2.1";
|
| 4 | +analytics.load("{{this}}"); |
4 | 5 | analytics.page();
|
5 | 6 | }}();
|
6 | 7 | </script>
|
7 | 8 | {{/with}}
|
8 | 9 |
|
9 |
| -{{!-- {{#with site.keys.ketchSmartTagUrl}} --}} |
10 |
| -<script>!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/website_smart_tag/boot.js",e.defer=e.async=!0,document.getElementsByTagName("head")[0].appendChild(e)}();</script> |
| 10 | +{{#with site.keys.ketchSmartTagUrl}} |
| 11 | +<script>!function(){window.semaphore=window.semaphore||[],window.ketch=function(){window.semaphore.push(arguments)};var e=document.createElement("script");e.type="text/javascript",e.src="{{this}}",e.defer=e.async=!0,document.getElementsByTagName("head")[0].appendChild(e)}();</script> |
11 | 12 | <script>
|
12 |
| -if (ketch) { |
13 |
| - ketch('showPreferences'); |
14 |
| -
|
15 |
| - function saveConsent(consent) { |
16 |
| - window.ketchConsent = consent; |
17 |
| - }; |
18 |
| - ketch("on", "consent", (consent) => { |
19 |
| - saveConsent(consent); |
20 |
| - // Only load Segment analytics if the user has consented to analytics |
21 |
| - if (consent?.purposes?.analytics && window.analytics) { |
22 |
| - window.analytics.load("{{../site.keys.segment}}"); |
23 |
| - } |
24 |
| - }); |
25 |
| - ketch("on", "userConsentUpdated", saveConsent); |
26 |
| - ketch("on", "regionInfo", regionInfo => { |
27 |
| - var customTextRegions = ["US-CA"]; |
28 |
| - if (customTextRegions.includes(regionInfo)) { |
29 |
| - var preferenceCenterLinkElement = document.getElementById("preferenceCenterLink"); |
30 |
| - preferenceCenterLinkElement.textContent = "Do Not Sell My Personal Information"; |
| 13 | +ketch('showPreferences'); |
| 14 | +</script> |
| 15 | +<script> |
| 16 | +function saveConsent(consent) { |
| 17 | + window.ketchConsent = consent; |
| 18 | +}; |
| 19 | +ketch("on", "consent", (consent) => { |
| 20 | + saveConsent(consent); |
| 21 | + if (window.analytics) { |
| 22 | + window.analytics.addSourceMiddleware(({ payload, next }) => { |
| 23 | + if (window.ketchConsent) { |
| 24 | + payload.obj.context.consent = { |
| 25 | + categoryPreferences: window.ketchConsent?.purposes, |
| 26 | + }; |
31 | 27 | }
|
32 |
| - }) |
33 |
| -} |
| 28 | + next(payload); |
| 29 | + }); |
| 30 | + } |
| 31 | +}); |
| 32 | +ketch("on", "userConsentUpdated", saveConsent); |
| 33 | +ketch("on", "regionInfo", regionInfo => { |
| 34 | + var customTextRegions = ["US-CA"]; |
| 35 | + if (customTextRegions.includes(regionInfo)) { |
| 36 | + var preferenceCenterLinkElement = document.getElementById("preferenceCenterLink"); |
| 37 | + preferenceCenterLinkElement.textContent = "Do Not Sell My Personal Information"; |
| 38 | + } |
| 39 | +}) |
34 | 40 | </script>
|
35 |
| -{{!-- {{/with}} --}} |
| 41 | +{{/with}} |
36 | 42 |
|
37 | 43 | <script>var uiRootPath = '{{{uiRootPath}}}'</script>
|
38 | 44 |
|
|
0 commit comments