Skip to content

Commit

Permalink
Removed adobe consent check
Browse files Browse the repository at this point in the history
  • Loading branch information
mehakraza committed May 3, 2024
1 parent 3d8196c commit 6181e98
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 35 deletions.
42 changes: 18 additions & 24 deletions extensions/brandstory/brandstory_milestones.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Function to get extension number from domains
function getDomainExtensionValue(domain) {
// Function to get tag number from domains
function getDomainTagValue(domain) {
if (domain.includes('welt.de')) {
return [206];
} else if (domain.includes('bild.de')) {
Expand All @@ -10,27 +10,21 @@ function getDomainExtensionValue(domain) {
}
}

// Get consent cookie and check Adobe consent
const consentCookie = document.cookie.match(/cmp_cv_list=([a-zA-Z0-9_,-]*)/)?.pop() || '';
const isAdobeConsentGiven = consentCookie.includes('adobe_analytics');
// Get domain-specific tag number
const tagNumber = getDomainTagValue(window.location.hostname);

// Get domain-specific exntension number
const extensionNumber = getDomainExtensionValue(window.location.hostname);
// Set milestones
window.onload = function setMilestones() {
const milestones = [
{ label: '5', time: 5000 },
{ label: '30', time: 30000 },
{ label: '60', time: 60000 },
{ label: '180', time: 180000 }
];

// If Adobe consent is given, set milestones
if (isAdobeConsentGiven) {
window.onload = function setMilestones() {
const milestones = [
{ label: '5', time: 5000 },
{ label: '30', time: 30000 },
{ label: '60', time: 60000 },
{ label: '180', time: 180000 }
];

milestones.forEach(milestone => {
setTimeout(() => {
window.utag.link({ event_name: 'article_milestone', event_label: milestone.label }, null, extensionNumber);
}, milestone.time);
});
};
}
milestones.forEach(milestone => {
setTimeout(() => {
window.utag.link({ event_name: 'article_milestone', event_label: milestone.label }, null, tagNumber);
}, milestone.time);
});
};
18 changes: 7 additions & 11 deletions extensions/brandstory/brandstory_scrolldepth.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ function getCookie(cookieName) {
return '';
}

// Function to get extension number from domains
function getDomainExtensionValue(domain) {
// Function to get tag number from domains
function getDomainTagValue(domain) {
if (domain.includes('welt.de')) {
return [206];
} else if (domain.includes('bild.de')) {
Expand All @@ -34,15 +34,11 @@ window.addEventListener('scroll', function () {
const s_ppv = getCookie('s_ppv');
let scrollDepth = parseInt(s_ppv);

// Check if consent for Adobe is given
const existingCookie = document.cookie.match(/cmp_cv_list=([a-zA-Z0-9_,-]*)/)?.pop() || '';
const isAdobeConsentGiven = existingCookie.includes('adobe_analytics');
// Get domain-specific tag number
const tagNumber = getDomainTagValue(window.location.hostname);

// Get domain-specific exntension number
const extensionNumber = getDomainExtensionValue(window.location.hostname);

// Check scroll depth and consent for Adobe
if (scrollDepth <= 100 && isAdobeConsentGiven) {
// Check scroll depth
if (scrollDepth <= 100) {
// Check if scroll depth is 50, 75 or 100
if (scrollDepth === 50 || scrollDepth === 75 || scrollDepth === 100) {
scrollArray.push(scrollDepth);
Expand All @@ -52,7 +48,7 @@ window.addEventListener('scroll', function () {
'event_action': 'view' + scrollDepth,
'page_platform': window.utag.data.page_platform,
'adobe_pageName': window.utag.data.adobe_pageName,
}, null, extensionNumber);
}, null, tagNumber);
}
}
});

0 comments on commit 6181e98

Please sign in to comment.