Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC-4329: Ketch footer and Segment updates #179

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9fee0e0
Add consent management link to footer
eric-schneider Jan 9, 2025
35bacac
dynamic footer text and consent context added to segment calls
colegoldsmith Jan 9, 2025
c0dd2bc
fix consent object
colegoldsmith Jan 9, 2025
e00c57d
Make footer link conditional
eric-schneider Jan 9, 2025
bbca953
Shorten data-track attribute
eric-schneider Jan 9, 2025
55e9c9f
Squash merge remove-gtm-scripts into DOC-4329-footer
colegoldsmith Jan 15, 2025
b5697a9
fix track events so they use consent context correctly. Only load seg…
colegoldsmith Jan 16, 2025
a2de33e
Merge branch 'main' into DOC-4329-footer
colegoldsmith Jan 16, 2025
0cf2a0f
manual ketch url for testing purposes, revert this soon
colegoldsmith Jan 16, 2025
6a7cfaf
test showing ketch preferences on load
colegoldsmith Jan 16, 2025
23e91e0
fix segment object
colegoldsmith Jan 16, 2025
ecabb4f
load segment initially, update ketch scripts
colegoldsmith Jan 16, 2025
9213d6a
hard code keys
colegoldsmith Jan 16, 2025
a363a1c
undo hard coded site keys
colegoldsmith Jan 17, 2025
3c2eea0
add ketch logic to js file and let middleware handle context
colegoldsmith Jan 21, 2025
ec60950
update to latest changes from marketing without gtag scripts
colegoldsmith Jan 24, 2025
89d00a4
UNDO THIS - hard coding segment and ketch site keys
colegoldsmith Jan 24, 2025
0350d78
use segment prod source
colegoldsmith Jan 24, 2025
459745d
force a rebuild
colegoldsmith Jan 24, 2025
0663bb2
use dev segment source
colegoldsmith Jan 24, 2025
2652537
add gtag script and use staging www site footer link
colegoldsmith Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/js/04-segment-analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,26 @@
const trackedLinkElements = document.querySelectorAll('a[data-track]')
const trackedElements = document.querySelectorAll('[data-track]:not(a)')

const context = {
consent: {
categoryPreferences: {
advertising: 'behavioral_advertising',
ketch_purpose_code: 'ketch_purpose_code',
analytics: 'analytics',
data_broking: 'data_broking',
personalization: 'personalization',
essential_services: 'essential_services',
},
},
}

trackedLinkElements.forEach((element) => {
window.analytics.trackLink(element, element.dataset.track)
window.analytics.trackLink(element, element.dataset.track, context)
})

trackedElements.forEach((element) => {
element.addEventListener('click', (e) => {
window.analytics.track(element.dataset.track)
window.analytics.track(element.dataset.track, context)
})
})
}
Expand Down
10 changes: 10 additions & 0 deletions src/js/05-feedback-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
if (message && window.analytics) {
window.analytics.track('Feedback Form', {
message,
consent: {
categoryPreferences: {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed in the segment docs this consent object uses boolean values instead of strings. I think This values should be based on the ketch preferences

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @EladioGaldamez! I copied some of your PR and created a global scope track event that includes the correct consent context gathered from what the user selects in the Ketch popup

advertising: 'behavioral_advertising',
ketch_purpose_code: 'ketch_purpose_code',
analytics: 'analytics',
data_broking: 'data_broking',
personalization: 'personalization',
essential_services: 'essential_services',
},
},
})
}
form.elements.message.value = ''
Expand Down
10 changes: 10 additions & 0 deletions src/js/07-copy-to-clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@
snippetLanguage: language,
snippetTitle: title,
snippetSample: sample,
consent: {
categoryPreferences: {
advertising: 'behavioral_advertising',
ketch_purpose_code: 'ketch_purpose_code',
analytics: 'analytics',
data_broking: 'data_broking',
personalization: 'personalization',
essential_services: 'essential_services',
},
},
})
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/partials/footer.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
target="_blank"
data-track="Footer Terms of Use Link Clicked"
>Terms of use</a>
{{#with site.keys.ketchSmartTagUrl}}
|
<a
id="preferenceCenterLink"
href="https://www.datastax.com/preferences"
data-track="Footer Consent Preference Link Clicked"
>Manage Privacy Choices</a>
{{/with}}
</span>
</p>
<p class="text-tertiary !m-0 max-w-[640px] text-xs">Apache, Apache
Expand Down
9 changes: 9 additions & 0 deletions src/partials/head-prelude.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@
{{/with}}
{{#with site.keys.ketchSmartTagUrl}}
<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>
<script>
ketch('on', 'regionInfo', regionInfo => {
eric-schneider marked this conversation as resolved.
Show resolved Hide resolved
var customTextRegions = ['US-CA'];
if (customTextRegions.includes(regionInfo)) {
var preferenceCenterLinkElement = document.getElementById("preferenceCenterLink");
preferenceCenterLinkElement.textContent = "Do Not Sell My Personal Information";
}
})
</script>
{{/with}}
Loading