feat(05-purchase-redirect-hardening): harden purchase redirect tracking
Phase 5 complete: - guard purchase event per transaction in sessionStorage - restore saved consent before GTM and purchase - add centered Przelewy24 countdown redirect
This commit is contained in:
@@ -45,6 +45,38 @@
|
||||
'ad_personalization': 'denied',
|
||||
'wait_for_update': 500
|
||||
});
|
||||
|
||||
(function() {
|
||||
function getCookie(name) {
|
||||
var cookies = document.cookie.split(';');
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
var cookie = cookies[i].trim();
|
||||
if (cookie.indexOf(name + '=') === 0) {
|
||||
return decodeURIComponent(cookie.substring(name.length + 1));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
var consent = JSON.parse(getCookie('cnp_consent'));
|
||||
var preferences = JSON.parse(getCookie('cnp_prefs'));
|
||||
|
||||
if (consent !== true || !Array.isArray(preferences)) {
|
||||
return;
|
||||
}
|
||||
|
||||
gtag('consent', 'update', {
|
||||
'analytics_storage': preferences.indexOf('analytics') > -1 ? 'granted' : 'denied',
|
||||
'ad_storage': preferences.indexOf('marketing') > -1 ? 'granted' : 'denied',
|
||||
'ad_user_data': preferences.indexOf('marketing') > -1 ? 'granted' : 'denied',
|
||||
'ad_personalization': preferences.indexOf('marketing') > -1 ? 'granted' : 'denied'
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn('Consent Mode: could not restore saved cookie preferences.', error);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<!-- End Google Consent Mode v2 - default -->
|
||||
<!-- Google Tag Manager -->
|
||||
|
||||
Reference in New Issue
Block a user