/*! * consent-rto-jp — static copy of the Data API record (WEBSITES-7768, 2026-11-13). Served from disk * at /api/data/get/consent-rto-jp before PHP. No JS Content-Type: never enable nosniff for this path. * Edit = edit this file and deploy, not the BO. Docs: docs/CONSENT-AND-COOKIES.md §6.1. */ console.log("-== RTO GTM Consent v2.0.2 JP ==-"); if (typeof window.pageLang === "undefined") { window.pageLang = "ja"; window.__YCW_LANG = 'ja'; } if (typeof window.gtag !== "function") { window.dataLayer = window.dataLayer || []; window.gtag = function () { window.dataLayer.push(arguments); }; } gtag("consent", "default", { ad_storage: "denied", ad_user_data: "denied", ad_personalization: "denied", analytics_storage: "denied" }); function getCookieSimple(name) { const searchName = `${name}=`; const cookiesDecoded = decodeURIComponent(document.cookie); const cookiesArray = cookiesDecoded.split("; "); const found = cookiesArray.find((item) => item.indexOf(searchName) === 0); if (found) { return found.substring(searchName.length); } return ""; } function saveGtagDataSimple(data) { try { gtag("consent", "update", { ad_storage: data.advertising ? "granted" : "denied", analytics_storage: data.performance ? "granted" : "denied", ad_personalization: data.personalizedAdvertising ? "granted" : "denied", ad_user_data: data.useDataForAdvertising ? "granted" : "denied" }); console.log("-== Consent was updated from cookie ==-"); } catch (e) { console.log("Google tag manager is not found"); } } function restoreConsentFromCookie() { const cookieName = "yummyCookieWidget_userData"; const savedData = getCookieSimple(cookieName); if (!savedData) { return; } try { const parsedSavedData = JSON.parse(savedData); saveGtagDataSimple(parsedSavedData); } catch (e) { console.log("--== Invalid consent cookie, skip restore ==--"); } } function bindOpenPrivacySettings() { const openPrivacySettingsElement = document.getElementById("open-privacy-settings"); if (!openPrivacySettingsElement) { return; } openPrivacySettingsElement.addEventListener("click", (event) => { event.preventDefault(); if (window.yummyCookieWidget) { window.yummyCookieWidget.setWidgetVisibility(true); window.yummyCookieWidget.setScreenVisibility(1); } }); } function addCookieWidgetScript() { if (document.getElementById("ycw-script")) { return; } const scriptElement = document.createElement("script"); scriptElement.id = "ycw-script"; scriptElement.async = true; scriptElement.src = "https://www.dukascopy.com/api/data/get/yummyCookieWidget?lang=ja&forJs=1&branchId=5&noCache=0&v=2.1.0"; document.body.appendChild(scriptElement); } function initCookieCallerJP() { // Always use JP flow: no Swiss/EU branching, no geolocation checks. // Всегда используем JP-сценарий: без ветвления Swiss/EU и без проверок геолокации. restoreConsentFromCookie(); bindOpenPrivacySettings(); addCookieWidgetScript(); } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", initCookieCallerJP); } else { initCookieCallerJP(); }