mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-03 01:48:32 +02:00
Add Onetrust consent preferences to url params (#1939)
* adding onetrust consent preferences to outbout links to cloud.io * ot_consent => qdrant_tech_ot_consent
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
persistUTMParams
|
||||
} from './helpers';
|
||||
import { handleSegmentReady } from './segment-helpers';
|
||||
import { registerAndCall } from './onetrust-helpers';
|
||||
import { addOneTrustPreferencesToLinks, registerAndCall } from './onetrust-helpers';
|
||||
import TableOfContents from './table-of-content';
|
||||
|
||||
persistUTMParams();
|
||||
@@ -16,7 +16,10 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
addUTMToLinks();
|
||||
|
||||
const handleOneTrustLoaded = () => { // One Trust Loaded
|
||||
addOneTrustPreferencesToLinks();
|
||||
|
||||
window.OneTrust.OnConsentChanged(async () => { // One Trust Preference Updated
|
||||
addOneTrustPreferencesToLinks();
|
||||
registerAndCall();
|
||||
|
||||
await window.analytics.track('onetrust_consent_preference_updated', {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
const CONSENT_PARAM_KEY = 'qdrant_tech_ot_consent';
|
||||
|
||||
export function registerAndCall() {
|
||||
const consentPreferences = window.OnetrustActiveGroups ?? '';
|
||||
|
||||
@@ -43,4 +45,24 @@ export function setOneTrustDataSubjectId() {
|
||||
if (!anonymousId) return;
|
||||
|
||||
window.OneTrust.setDataSubjectId(anonymousId, true, 'AnonymousID');
|
||||
}
|
||||
|
||||
export function addOneTrustPreferencesToLinks() {
|
||||
const activeGroups = window.OnetrustActiveGroups;
|
||||
|
||||
if (!activeGroups || typeof activeGroups !== 'string') return;
|
||||
|
||||
const links = document.querySelectorAll('a[href*="cloud.qdrant.io"]');
|
||||
|
||||
links.forEach(link => {
|
||||
let url = new URL(link.href);
|
||||
|
||||
if (url.searchParams.has(CONSENT_PARAM_KEY)) {
|
||||
url.searchParams.delete(CONSENT_PARAM_KEY);
|
||||
}
|
||||
|
||||
url.searchParams.set(CONSENT_PARAM_KEY, activeGroups);
|
||||
|
||||
link.href = url.toString();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user