{"webLayers":[],"experiments":[],"constantManagedTags":[{"uses_overlay":false,"type":"js","parametrized_definition":"console.group('Purchased Count Banner Tag');\n\nfunction debounce(fn, delay) {\n    let timeoutId;\n\n    return function (...args) {\n        clearTimeout(timeoutId);\n        timeoutId = setTimeout(() =\u003e {\n            fn.apply(this, args);\n        }, delay);\n    };\n}\n\nconst throttle = (fn, delay) =\u003e {\n    let last = 0;\n    return (...args) =\u003e {\n        let now = new Date().getTime();\n        if (now - last \u003c delay) {\n            return;\n        }\n        last = now;\n        return fn(...args);\n    }\n}\n\n// Get the Product ID from the URL\nfunction getProductId() {\n    const path = window.location.pathname;\n    const searchParams = new URLSearchParams(window.location.search);\n\n    // Get base\n    const pathArray = path.split('/');\n    const lastSegment = pathArray[pathArray.length - 1];\n    const lastSegmentArray = lastSegment.split('-');\n    const baseId = lastSegmentArray[lastSegmentArray.length - 1];\n\n    const color = searchParams.get('color');\n    const productId = `${baseId}${color}`;\n    return productId;\n}\n\nfunction getProductIdFromImageUrl(url) {\n    // Example: .../VN000D5VEMQ-HERO/washed-black-swatch.jpg\n    // Extract the segment before the last '/' and split by '-' to get the product id\n    if (!url) return '';\n    const parts = url.split('/');\n    if (parts.length \u003c 2) return '';\n    const segment = parts[parts.length - 2]; // e.g., 'VN000D5VEMQ-HERO'\n    return segment.split('-')[0]; // e.g., 'VN000D5VEMQ'\n}\n\nconst productId = getProductId();\nconsole.log('Product ID:', productId);\n\n// Banner - Top Right on PDP\n// exponea.showWebLayer('68a71bda58d66e0efcacbbd4', { \"product_id\": productId });\n\n// Banner - Over First Product Image\n exponea.showWebLayer('68a7231ce9f9f5570a2dfd58', { \"product_id\": productId });\n\n\ndocument.addEventListener('click', debounce(function (event) {\n    // console.log('Click event detected:', event.target);\n    if (event.target.matches('button[data-test-id=\"vf-color-picker\"] \u003e span \u003e span')) {\n        const imageUrl = event.target.src;\n        const swatchProductId = getProductId();\n        console.log('Product ID from image URL:', swatchProductId);\n\n        const bannerTopRight = document.querySelector('div.exp_social-proof__top-right[data-product-id=\"' + swatchProductId + '\"]');\n        const bannerOverImage = document.querySelector('div.exp_social-proof__over-image[data-product-id=\"' + swatchProductId + '\"]');\n\n        if (bannerTopRight || bannerOverImage) {\n            console.log('Swatch product ID matches the current product ID, no action needed.');\n            return;\n        }\n\n        // Banner - Top Right on PDP\n       // exponea.showWebLayer('68a71bda58d66e0efcacbbd4', { \"product_id\": swatchProductId });\n\n        // Banner - Over First Product Image\n        exponea.showWebLayer('68a7231ce9f9f5570a2dfd58', { \"product_id\": swatchProductId });\n\n    }\n}, 350), false);\n\nconsole.groupEnd();","trigger":{"include_pages":[{"url":"/en-us/p/","type":"contains"}],"exclude_pages":null},"_id":"68a7233070475afef8cecc30"},{"uses_overlay":false,"type":"js","parametrized_definition":"console.group('Purchased Count Banner Tag');\n\nfunction debounce(fn, delay) {\n    let timeoutId;\n\n    return function (...args) {\n        clearTimeout(timeoutId);\n        timeoutId = setTimeout(() =\u003e {\n            fn.apply(this, args);\n        }, delay);\n    };\n}\n\nconst throttle = (fn, delay) =\u003e {\n    let last = 0;\n    return (...args) =\u003e {\n        let now = new Date().getTime();\n        if (now - last \u003c delay) {\n            return;\n        }\n        last = now;\n        return fn(...args);\n    }\n}\n\n// Get the Product ID from the URL\nfunction getProductId() {\n    const path = window.location.pathname;\n    const searchParams = new URLSearchParams(window.location.search);\n\n    // Get base\n    const pathArray = path.split('/');\n    const lastSegment = pathArray[pathArray.length - 1];\n    const lastSegmentArray = lastSegment.split('-');\n    const baseId = lastSegmentArray[lastSegmentArray.length - 1];\n\n    const color = searchParams.get('color');\n    const productId = `${baseId}${color}`;\n    return productId;\n}\n\nfunction getProductIdFromImageUrl(url) {\n    // Example: .../VN000D5VEMQ-HERO/washed-black-swatch.jpg\n    // Extract the segment before the last '/' and split by '-' to get the product id\n    if (!url) return '';\n    const parts = url.split('/');\n    if (parts.length \u003c 2) return '';\n    const segment = parts[parts.length - 2]; // e.g., 'VN000D5VEMQ-HERO'\n    return segment.split('-')[0]; // e.g., 'VN000D5VEMQ'\n}\n\nconst productId = getProductId();\nconsole.log('Product ID:', productId);\n\n// Banner - Top Right on PDP\n// exponea.showWebLayer('68a7230e70475afef8cecc2b', { \"product_id\": productId });\n\n// Banner - Over First Product Image\nexponea.showWebLayer('68a72321b398ced987beabbc', { \"product_id\": productId });\n\n\ndocument.addEventListener('click', debounce(function (event) {\n    // console.log('Click event detected:', event.target);\n    if (event.target.matches('button[data-test-id=\"vf-color-picker\"] \u003e span \u003e span')) {\n        const imageUrl = event.target.src;\n        const swatchProductId = getProductId();\n        console.log('Product ID from image URL:', swatchProductId);\n\n        const bannerTopRight = document.querySelector('div.exp_social-proof__top-right[data-product-id=\"' + swatchProductId + '\"]');\n        const bannerOverImage = document.querySelector('div.exp_social-proof__over-image[data-product-id=\"' + swatchProductId + '\"]');\n\n        if (bannerTopRight || bannerOverImage) {\n            console.log('Swatch product ID matches the current product ID, no action needed.');\n            return;\n        }\n\n        // Banner - Top Right on PDP\n        //exponea.showWebLayer('68a7230e70475afef8cecc2b', { \"product_id\": swatchProductId });\n\n        // Banner - Over First Product Image\n         exponea.showWebLayer('68a72321b398ced987beabbc', { \"product_id\": swatchProductId });\n\n    }\n}, 350), false);\n\nconsole.groupEnd();","trigger":{"include_pages":[{"url":"/en-ca/p/","type":"contains"},{"url":"/fr-ca/p/","type":"contains"}],"exclude_pages":null},"_id":"68a725e8b398ced987beabdd"}],"vars":{"data":[]}}