icon

Custom Event Setup

×

Click on the elements you want to track as custom events. Selected elements will appear in the list below.

Selected Elements (0)
    • 4 Easy and Tasty Tricolour Recipes

      4 Easy and Tasty Tricolour Recipes

      This year, with the long weekend approaching, celebrate the 77th Independence Day with some delicious recipes in tricolour. Whether you're hosting a backyard barbecue, a family picnic, or a cozy indoor gathering, these easy and tasty recipes is sure to bring a sense of unity, patriotism, and joy to your Independence Day celebrations. Get ready to impress your guests and ignite your taste buds...
    You have successfully subscribed!
    This email has been registered
    ", defaultCountry, geoCountries.includes(defaultCountry) ); return geoCountries.includes(defaultCountry); }; const startOTPObserverIfEligible = async () => { const shouldRunOTP = await checkDefaultCountry(); if (shouldRunOTP) { codkLog("observePreOrderOTPEnabled running"); observePreOrderOTPEnabled(); } else { codkLog("OTP observer skipped due to geo restrictions."); enableNormalCheckout(); } }; try { console.log( "%c████████████ COD King 2 ████████████", "font-weight: bold; font-size: 14px; background: red; color: white; padding: 4px 8px; border-radius: 4px;" ); disableNormalCheckout(); setTimeout(async function () { codkLog("before calling setting from extension"); let settings; const settingsChanged = sessionStorage.getItem("codk_settings_changed"); const settingsStr = sessionStorage.getItem("settingSession"); if (settingsChanged || !settingsStr) { if (settingsChanged) { sessionStorage.removeItem("codk_settings_changed"); codkLog("Metafield changed - calling fetchSettings() to update settingSession"); } const response = await fetchSettings(); if (response) { const newSettings = codkMapSettingsToCamel({ ...response, routeUrl: ROUTE_URL.replace(/\/$/, ""), shopDomain: window.Shopify.shop, }); sessionStorage.setItem("settingSession", JSON.stringify(newSettings)); startOTPObserverIfEligible(); if (newSettings?.partialPaymentEnabled === true) { callPartialRuleSets(); callPartialDummyVariantId(); } settings = newSettings; } else { codkLog("Failed to load settings from server."); enableNormalCheckout(); return; } } else { settings = JSON.parse(settingsStr); const needsMigration = settings && !("enablePreOrderOtp" in settings) && "enable_pre_order_otp" in settings; if (needsMigration) { const migratedSettings = codkMapSettingsToCamel(settings); sessionStorage.setItem( "settingSession", JSON.stringify(migratedSettings) ); settings = migratedSettings; } startOTPObserverIfEligible(); if (settings?.partialPaymentEnabled === true) { const ruleSets = JSON.parse(sessionStorage.getItem("ruleSets")); if (!ruleSets) { callPartialRuleSets(); } const variantId = sessionStorage.getItem("partialDummyVariantId"); if (!variantId) { callPartialDummyVariantId(); } } } if (settings?.partialPaymentEnabled === true) { initProductHiding(); } loadScript(); }, 10); } catch (e) { codkLog("Error Loading OTP Box, Please reach out to us via chat bubble"); enableNormalCheckout(); } })(); }; const initSvelteApp = function(buttonBlocking, settings) { window.codkInitSvelteApp = () => initSvelteApp(buttonBlocking, settings); // Ensure ROUTE_URL is set if (typeof window.codkingRouteUrl === 'undefined' || !window.codkingRouteUrl || window.codkingRouteUrl.trim() === '') { console.error("❌ ROUTE_URL is empty in initSvelteApp!"); if (buttonBlocking) buttonBlocking.removeButtonListeners(); return; } const ROUTE_URL = window.codkingRouteUrl; const DEBUG = true; const codkLog = (msg, ...args) => { if (DEBUG) console.log(`[notifik_svelte.liquid] ${msg}`, ...args); }; codkLog("***************************** notifik_svelte.liquid loaded (SKELETON) *****************************"); codkLog("✅ web_ux_version is 2, initializing Svelte app"); // If buttonBlocking not provided, unblock and exit if (!buttonBlocking) { console.error("❌ buttonBlocking not provided to initSvelteApp!"); return; } const isMobile = () => { const viewportWidth = window.parent && window.parent !== window ? window.parent.innerWidth : window.innerWidth; return viewportWidth <= 640; }; const showIframe = (iframe) => { if (!iframe) return; iframe.setAttribute('data-visible', 'true'); // Fire global event when the iframe-based modal becomes visible // (Do NOT fire this on iframe creation because the iframe is preloaded.) try { if (!window.codkOtpModalOpen) { const parentWindow = window.parent || window; parentWindow.dispatchEvent(new Event("codking:otpModalOpened")); window.codkOtpModalOpen = true; codkLog("📣 Dispatched codking:otpModalOpened"); // IMMEDIATE FALLBACK: If cart drawer manager isn't ready yet (first open), // directly hide cart drawers using Strategy 6 logic (Razorpay Magic Checkout pattern). // This is the EXACT same logic as initializeCartDrawerHidingLogicSix.closeCartDrawerSafely() const hideCartDrawerFallback = function() { try { const cartDrawerLayouts = getCartDrawerLayouts(); // Iterate through all cart drawer layout selectors (from COD_CART_DRAWER_LAYOUT) for (const selector of cartDrawerLayouts) { try { const element = document.querySelector(selector); if (!element) continue; // If it's a component with close() method, use it (like Razorpay Magic Checkout) const elementAny = element; if (typeof elementAny.close === "function") { try { elementAny.close(); codkLog(" 🔒 Fallback: Closed via " + selector + ".close()"); return true; } catch (e) { codkLog(" ⚠️ Fallback: " + selector + ".close() failed:", e); // continue to try dialog fallback } } // Fallback: find dialog[open] inside the cart drawer element const dialog = element.querySelector("dialog[open]"); if (dialog) { try { dialog.close(); dialog.removeAttribute("open"); codkLog(" 🔒 Fallback: Closed dialog inside " + selector); return true; } catch (e) { codkLog(" ⚠️ Fallback: Failed to close dialog in " + selector + ":", e); // continue to next selector } } // If the element itself is a dialog with open attribute if (element.tagName === "DIALOG" && element.hasAttribute("open")) { try { element.close(); element.removeAttribute("open"); codkLog(" 🔒 Fallback: Closed dialog " + selector); return true; } catch (e) { codkLog(" ⚠️ Fallback: Failed to close dialog " + selector + ":", e); // continue to next selector } } } catch (e) { // Skip invalid selectors codkLog(" ⚠️ Fallback: Invalid selector " + selector + ":", e); } } return false; } catch (e) { codkLog("⚠️ Fallback hide failed:", e); return false; } }; // Try immediate fallback first (works even if Svelte cart drawer manager hasn't loaded) hideCartDrawerFallback(); // Also retry calling the handler directly until it exists (for full strategy support) const tryHideDrawer = function(attempt) { try { if (typeof parentWindow.codkingHideDrawer === "function") { parentWindow.codkingHideDrawer(); codkLog("📣 Called codkingHideDrawer() directly"); return; } } catch (e) {} if ((attempt || 0) < 40) { setTimeout(function() { tryHideDrawer((attempt || 0) + 1); }, 50); } }; tryHideDrawer(0); } } catch (e) { // fail silently } codkLog("✅ Iframe shown (CSS from Svelte)"); }; const hideIframe = (iframe) => { if (!iframe) return; iframe.setAttribute('data-visible', 'false'); // Fire global event when the iframe-based modal is hidden try { if (window.codkOtpModalOpen) { (window.parent || window).dispatchEvent(new Event("codking:otpModalClosed")); window.codkOtpModalOpen = false; codkLog("📣 Dispatched codking:otpModalClosed"); } } catch (e) { // fail silently } codkLog("✅ Iframe hidden (CSS from Svelte)"); }; if (!window.codkIframeDestroyListenerAdded) { window.codkIframeDestroyListenerAdded = true; window.addEventListener('message', (event) => { if ( event.data && typeof event.data === 'object' && event.data.type === 'CODK_DESTROY_IFRAME' ) { const iframeId = event.data.iframeId || 'codk-full-modal-svelte'; const targetIframe = document.getElementById(iframeId); if (targetIframe && targetIframe.parentNode) { codkLog("🧹 Removing iframe via CODK_DESTROY_IFRAME message:", iframeId); targetIframe.parentNode.removeChild(targetIframe); // If the modal was open, ensure we emit a close event on destroy try { if (window.codkOtpModalOpen) { (window.parent || window).dispatchEvent(new Event("codking:otpModalClosed")); window.codkOtpModalOpen = false; codkLog("📣 Dispatched codking:otpModalClosed (destroy)"); } } catch (e) { // fail silently } } else { codkLog("ℹ️ CODK_DESTROY_IFRAME: iframe not found (maybe already removed)", iframeId); } const wrapper = document.getElementById('codk-modal-wrapper'); if (wrapper) { wrapper.setAttribute('data-visible', 'false'); wrapper.style.display = 'none'; } iframe = null; window.codkSvelteInitialized = false; window.codkingSvelteReady = false; window.codkSvelteAppMounted = false; window.codkModalShowingSpinner = false; setTimeout(() => { iframe = ensureIframe(); if (typeof window.codkInitSvelteApp === "function") { window.codkInitSvelteApp(); } }, 50); return; } if ( event.data && typeof event.data === 'object' && event.data.type === 'CODK_REDIRECT_TO_CHECKOUT' ) { codkLog("🚀 Received CODK_REDIRECT_TO_CHECKOUT message"); if (typeof enableNormalCheckout === "function") { enableNormalCheckout(); } try { window.location.href = "/checkout"; } catch (redirectError) { console.warn("[app-embed.liquid] ⚠️ Parent redirect failed:", redirectError); } return; } }); } const ensureIframe = () => { let iframeElement = document.getElementById('codk-full-modal-svelte'); if (!iframeElement) { iframeElement = document.createElement('iframe'); iframeElement.id = 'codk-full-modal-svelte'; iframeElement.setAttribute('data-visible', 'false'); document.body.appendChild(iframeElement); codkLog("✅ Iframe created (CSS handled by Svelte)", { isMobile: isMobile() }); } else { codkLog("⏸️ Iframe already exists - reusing existing iframe"); } return iframeElement; }; let iframe = ensureIframe(); if (window.codkSvelteInitialized) { codkLog("⏸️ Svelte app already initialized - skipping duplicate initialization"); } else { window.codkSvelteInitialized = true; const initializeSvelteApp = () => { try { if (iframe.contentWindow && iframe.contentWindow.codkingSvelteReady) { codkLog("⏸️ Svelte app already ready in iframe - skipping initialization"); return; } try { const iframeDoc = iframe.contentWindow.document; if (iframeDoc && iframeDoc.body) { const existingScript = iframeDoc.querySelector('script[type="module"][src*="notifik_svelte"]'); if (existingScript) { codkLog("⏸️ Script tag already exists in iframe - skipping initialization (app may be loading)"); return; } } } catch (e) { codkLog("⚠️ Could not check iframe document (may not be ready yet):", e.message); } codkLog("🚀 Initializing iframe with Svelte app..."); const iframeDoc = iframe.contentWindow.document; iframeDoc.open(); const bodyStyle = isMobile() ? 'margin:0;padding:0;background:transparent;height:100vh;' : 'margin:0;padding:0;background:transparent;height:auto;min-height:100%;'; const htmlStyle = isMobile() ? 'background:transparent;height:100%;' : 'background:transparent;height:auto;min-height:100%;'; window.codkSvelteAppMounted = false; iframeDoc.write( '' + '' + 'COD King OTP' + '' + '' + '
    ' + '
    OTP graphic
    OTP graphic
    tag in theme.liquid 2. The quiz will automatically open when clicking any link with href="#kitchen-quiz" Example button/link: Find Your Perfect Colour ═══════════════════════════════════════════════════════════════════════════ -->

    Kitchen Energy Quiz

    Discover the colour that feels like home

    Your kitchen isn't just where you cook — it's where you reset, gather, and create. This quiz reveals the ceramic colour that matches your energy, your rhythm, and the way you move through life.

    Ceramic Colour Quiz
    1 of 4