{"webLayers":[{"_id":"67bc92b2ec73cac11d394322","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"type":"any"}],"exclude_pages":null},"device_target":{"type":"desktop"},"frequency":"always","uses_personalization":true,"data":"","variables_target":{"conditions":[{"attribute":{"id":"67bc74e6aa7034bb355fcb50","type":"page_variable"},"constraint":{"operands":[{"type":"constant","value":"www"}],"operator":"in","type":"string"}},{"attribute":{"id":"67bc7bed918a683daac200a2","type":"page_variable"},"constraint":{"operands":[{"type":"constant","value":"en-ca"},{"type":"constant","value":"fr-ca"}],"operator":"in","type":"string"}}]},"page_vars":[]}],"experiments":[],"constantManagedTags":[{"uses_overlay":false,"type":"js","parametrized_definition":"console.log('Purchased Count Banner Tag - US');\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/**\n * Function to extract the product ID from the current page URL.\n * @returns {string} The product ID extracted from the URL.\n */\nfunction getProductId() {\n    const path = window.location.pathname;\n    const pathArray = path.split('/');\n    const lastSegment = pathArray[pathArray.length - 1];\n    const lastSegmentArray = lastSegment.split('-');\n    const productId = lastSegmentArray[lastSegmentArray.length - 1];\n    return productId;\n}\n\n/**\n * Function to extract the product ID from the image URL.\n * @param {string} url\n * @returns {string} The product ID extracted from the image URL.\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\n\nconst productId = getProductId();\n// console.log('Product ID:', productId);\nvar productIDs= ['VN000XW46X7', 'VN000XW49Y1', 'VN000XW4CJG', 'VN000XW4E0L', 'VN000XW4N5B', 'VN000DB824O', 'VN000DB8MCG', 'VN000DB8Z11','VN000EGWBLA','VN000EGWWVD','VN000EGWDFP','VN000EFUBLA','VN000EFUWVD','VN000D9PBKA','VN000D9PCAK','VN000D9PIND','VN000E8VYA6'];\n\nif (productIDs.includes(productId)) {\n    console.log('Product ID is in the list, skipping social login.');\n} else {\n    // Banner - Top Right on PDP\n\texponea.showWebLayer('68a64cf67007a25bb347722b', { \"product_id\": productId });\n\t// Banner - Over First Product Image\n\texponea.showWebLayer('68a64da036ba0101a6419cd6', { \"product_id\": productId });\n}\n\ndocument.addEventListener('click', debounce(function (event) {\n    if (event.target.matches('button[data-test-id=\"vf-color-picker\"] img')) {\n        const imageUrl = event.target.src;\n        const swatchProductId = getProductIdFromImageUrl(imageUrl);\n\t\n\t\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            return;\n        }\n\t\tif (productIDs.includes(swatchProductId)) {\n\t\t\t    console.log('Product ID is in the list, skipping social login.');\n\t\t\t    exponea.showWebLayer('68a64cf67007a25bb347722b', { \"product_id\": '123' });\n\t\t} else {\n\t\t\t// Banner - Top Right on PDP\n\t        exponea.showWebLayer('68a64cf67007a25bb347722b', { \"product_id\": swatchProductId });\n\t\n\t        // Banner - Over First Product Image\n\t        exponea.showWebLayer('68a64da036ba0101a6419cd6', { \"product_id\": swatchProductId });\n\t\t}\n        \n\n    }\n}, 350), false);\n","trigger":{"include_pages":[{"url":"/en-us/p/","type":"contains"}],"exclude_pages":[{"url":"www3","type":"contains"},{"url":"VN000XW46X7","type":"contains"},{"url":"VN000XW49Y1","type":"contains"},{"url":"VN000XW4CJG","type":"contains"},{"url":"VN000XW4E0L","type":"contains"},{"url":"VN000XW4N5B","type":"contains"},{"url":"VN000DB824O","type":"contains"},{"url":"VN000DB8MCG","type":"contains"},{"url":"VN000DB8Z11","type":"contains"},{"url":"VN000EGWBLA","type":"contains"},{"url":"VN000EGWWVD","type":"contains"},{"url":"VN000EGWDFP","type":"contains"},{"url":"VN000EFUBLA","type":"contains"},{"url":"VN000EFUWVD","type":"contains"},{"url":"VN000D9PBKA","type":"contains"},{"url":"VN000D9PCAK","type":"contains"},{"url":"VN000D9PIND","type":"contains"},{"url":"VN000E8VYA6","type":"contains"},{"url":"VN000D9RCJK","type":"contains"},{"url":"VN000D9RGRK","type":"contains"},{"url":"VN000Z6KBLA","type":"contains"},{"url":"VN000Z6KCJ7","type":"contains"},{"url":"VN000Y1D2BO","type":"contains"},{"url":"VN000Y1DICP","type":"contains"},{"url":"VN000E8VFST","type":"contains"}]},"_id":"68a64cc6994728798f73f9ea"},{"uses_overlay":false,"type":"js","parametrized_definition":"console.log('Purchased Count Banner Tag - US');\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/**\n * Function to extract the product ID from the current page URL.\n * @returns {string} The product ID extracted from the URL.\n */\nfunction getProductId() {\n    const path = window.location.pathname;\n    const pathArray = path.split('/');\n    const lastSegment = pathArray[pathArray.length - 1];\n    const lastSegmentArray = lastSegment.split('-');\n    const productId = lastSegmentArray[lastSegmentArray.length - 1];\n    return productId;\n}\n\n/**\n * Function to extract the product ID from the image URL.\n * @param {string} url\n * @returns {string} The product ID extracted from the image URL.\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\n\nconst productId = getProductId();\n// console.log('Product ID:', productId);\n\n// Banner - Top Right on PDP\nexponea.showWebLayer('68a652339111d29e88387f79', { \"product_id\": productId });\n\n// Banner - Over First Product Image\nexponea.showWebLayer('68a652563c5977ee1e31e9c6', { \"product_id\": productId });\n\n\ndocument.addEventListener('click', debounce(function (event) {\n    if (event.target.matches('button[data-test-id=\"vf-color-picker\"] img')) {\n        const imageUrl = event.target.src;\n        const swatchProductId = getProductIdFromImageUrl(imageUrl);\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            return;\n        }\n\n        // Banner - Top Right on PDP\n        exponea.showWebLayer('68a652339111d29e88387f79', { \"product_id\": swatchProductId });\n\n        // Banner - Over First Product Image\n        exponea.showWebLayer('68a652563c5977ee1e31e9c6', { \"product_id\": swatchProductId });\n\n    }\n}, 350), false);\n","trigger":{"include_pages":[{"url":"/en-ca/p/","type":"contains"},{"url":"/fr-ca/p/","type":"contains"}],"exclude_pages":[{"url":"www3","type":"contains"}]},"_id":"68a6521986a3e8e137b1b75e"}],"vars":{"data":[{"id":"67bc74e6aa7034bb355fcb50","name":"Subdomain","variable":{"type":"custom_function","custom_function":{"body":"const host = window.location.host;\nconst subdomain = window.location.host.match(/([^.\\/]+)(?=\\.vans\\.com)/)[1];\nreturn subdomain;"}}},{"id":"67bc7bed918a683daac200a2","name":"Locale","variable":{"type":"custom_function","custom_function":{"body":"const locale = document.querySelector('html').getAttribute('lang');\nreturn locale;"}}},{"id":"69a732012aa593e0ecccf3e4","name":"Locale","variable":{"type":"custom_function","custom_function":{"body":"const locale = document.querySelector('html').getAttribute('lang');\nconsole.log('locale:', locale);\nreturn locale;"}}}]}}