PageSourceSearch

https://guardianbikes.com/cdn/shop/t/548/assets/gb-ab.js?v=19675668699695139041772562354

js guardianbikes.com collected 2026-10-03 22:43:01 UTC 11,409 bytes, 2 lines download raw bytes

1const tests={"T003-TEST":{enabled:!1,variants:{A:{productProperties:[{pathnames:["/products/balance-bike","/products/14-inch-bike","/products/16-inch-bike","/products/20-inch-small-bike","/products/20-inch-large-bike","/products/24-inch-bike","/products/26-inch-bike"],key:"_gbab",value:"T001-A"}],selectors:[]},B:{productProperties:[{pathnames:["/products/balance-bike","/products/14-inch-bike","/products/16-inch-bike","/products/20-inch-small-bike","/products/20-inch-large-bike","/products/24-inch-bike","/products/26-inch-bike"],key:"_gbab",value:"T001-B"}],selectors:[{element:'.product-template[data-product-id="4837430001757"] .as-low-as-discounted-price',type:"innerText",value:"$289"},{element:'.product-template[data-product-id="4837426954333"] .as-low-as-discounted-price',type:"innerText",value:"$319"},{element:'.product-template[data-product-id="4837430394973"] .as-low-as-discounted-price',type:"innerText",value:"$339"},{element:'.product-template[data-product-id="4837430001757"] .ProductPrice-product-new-layout-combined',type:"innerText",value:"$289.00"},{element:'.product-template[data-product-id="4837426954333"] .ProductPrice-product-new-layout-combined',type:"innerText",value:"$319.00"},{element:'.product-template[data-product-id="4837430394973"] .ProductPrice-product-new-layout-combined',type:"innerText",value:"$339.00"},{element:'.product-template[data-product-id="4837430001757"] [data-pro-price]',type:"dataset",dataset:"proPrice",value:"$289.00"},{element:'.product-template[data-product-id="4837426954333"] [data-pro-price]',type:"dataset",dataset:"proPrice",value:"$319.00"},{element:'.product-template[data-product-id="4837430394973"] [data-pro-price]',type:"dataset",dataset:"proPrice",value:"$339.00"},{element:'.collection_with_options-grid-item[data-product="20-inch-small-bike"] .collection_with_options-price',type:"innerText",value:"$289"},{element:'.collection_with_options-grid-item[data-product="20-inch-large-bike"] .collection_with_options-price',type:"innerText",value:"$319"},{element:'.collection_with_options-grid-item[data-product="24-inch-bike"] .collection_with_options-price',type:"innerText",value:"$339"}]}}},T002:{enabled:!1,variants:{A:{productProperties:[],selectors:[]},B:{productProperties:[],selectors:[{element:".how-surestop-works-link .video-underline",type:"innerText",value:"LEARN TO RIDE IN 1 DAY\u2122"}]}}},"T004-EmptyTest":{enabled:!1,variants:{A:{productProperties:[],selectors:[]},B:{productProperties:[],selectors:[]}}},"T005-Sale-Messaging":{enabled:!1,variants:{A:{productProperties:[],selectors:[{type:"visibility",hide:".hero-image-v3--content--B",show:".hero-image-v3--content--A"}]},B:{productProperties:[],selectors:[{type:"visibility",hide:".hero-image-v3--content--A",show:".hero-image-v3--content--B"}]}}}};function addCSSRule(selector,rules){window.dynamicStyles||(window.dynamicStyles=document.createElement("style"),window.dynamicStyles.type="text/css",document.head.appendChild(window.dynamicStyles));const sheet=window.dynamicStyles.sheet,ruleIndex=sheet.cssRules.length;sheet.insertRule(`${selector} { ${rules} }`,ruleIndex)}function abSetCookie(name,value,days){var expires="";if(days){var date=new Date;date.setTime(date.getTime()+days*24*60*60*1e3),expires="; expires="+date.toUTCString()}document.cookie=name+"="+(value||"")+expires+"; path=/"}function abGetCookie(name){for(var nameEQ=name+"=",ca=document.cookie.split(";"),i=0;i<ca.length;i++){for(var c=ca[i];c.charAt(0)==" ";)c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length)}return null}function eraseCookie(name){document.cookie=name+"=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"}function abSetLocalStorage(name,value,days){const item={value,expiry:days?new Date().getTime()+days*24*60*60*1e3:null};localStorage.setItem(name,JSON.stringify(item))}
1function abGetLocalStorage(name){const itemStr=localStorage.getItem(name);if(!itemStr)return null;const item=JSON.parse(itemStr);return item.expiry&&new Date().getTime()>item.expiry?(localStorage.removeItem(name),null):item.value}function eraseLocalStorage(name){localStorage.removeItem(name)}function abAddProductProperty(key,value){let keySlug=key.replaceAll(" ","_");var input=$('<input id="preorded-property-'+keySlug+'" type="hidden" name="properties['+key+']" value="'+value+'" />')[0];$("#AddToCartForm").append(input)}function selectRandomVariant(test){const variants=Object.keys(test.variants);return variants[Math.floor(Math.random()*variants.length)]}function gbFormatPrice(cents){return cents%100==0?"$"+cents/100:(cents/100).toLocaleString("en-US",{style:"currency",currency:"USD"})}function gbGetQueryParam(param){var urlParams=new URLSearchParams(window.location.search),paramValue=urlParams.get(param);return paramValue}function applyVariant(testName,variant,applyProperties){console.log("***** testName",testName),console.log("***** variant",variant);const testVariant=tests[testName].variants[variant];let testVariantSelectors=testVariant.selectors;if(testVariant.selectors.forEach(selector=>{if(console.log("***** selector",selector),console.log("***** selector.type",selector.type),console.log("***** selector.type === 'visibility'",selector.type==="visibility"),console.log("***** selector.hide",selector.hide),console.log("***** selector.element",selector.element),selector.type==="visibility"){if(console.log("****** selector.type === 'visibility'"),selector.hide){const hideElements=document.querySelectorAll(selector.hide);console.log("***** hideElements",hideElements),hideElements.forEach(el=>{el.style.display="none",el.style.visibility="hidden"})}if(selector.show){const showElements=document.querySelectorAll(selector.show);console.log("***** showElements",showElements),showElements.forEach(el=>{el.style.display="flex",el.style.visibility="visible"})}}else document.querySelectorAll(selector.element).forEach(element=>{if(selector.type==="innerText")element.innerText=selector.value;else if(selector.type==="price"){let newPrice=element.dataset.gbPrice-selector.discount;element.innerText=gbFormatPrice(newPrice)}else selector.type==="dataset"&&(element.dataset[selector.dataset]=selector.value);selector.type!=="visibility"&&(element.style.visibility="visible")})}),applyProperties){let testVariantProductProperties=testVariant.productProperties;for(let i=0;i<testVariantProductProperties.length;i++){const testVariantProductProperty=testVariantProductProperties[i];testVariantProductProperty.pathnames.includes(window.location.pathname)&&abAddProductProperty(testVariantProductProperty.key,testVariantProductProperty.value)}}}function runTests(variant){for(let testName in tests){let test=tests[testName];test.enabled&&(variant||(variant=selectRandomVariant(test)),applyVariant(testName,variant,!0))}}function getUtmParamsFromShopifyCookie(){const shopifySaP=abGetCookie("_shopify_sa_p");if(!shopifySaP)return console.log("_shopify_sa_p cookie not found"),null;try{const decodedCookie=decodeURIComponent(shopifySaP),queryString=decodedCookie.includes("?")?decodedCookie:"?"+decodedCookie,searchParams=new URLSearchParams(queryString),utmParams={utm_source:searchParams.get("utm_source")||null,utm_medium:searchParams.get("utm_medium")||null,utm_campaign:searchParams.get("utm_campaign")||null,utm_content:searchParams.get("utm_content")||null,utm_term:searchParams.get("utm_term")||null};return console.log("UTM parameters extracted from _shopify_sa_p cookie:",utmParams),utmParams}catch(error){return console.error("Error parsing _shopify_sa_p cookie:",error),null}}function setABTestGroup(testName,variant){abSetLocalStorage(`gbab_${testName}`,variant);const shopifyUserId=abGetCookie("_shopify_y"),sessionId=abGetCookie("_shopify_s"),utmParams=getUtmParamsFromShopifyCookie();shopifyUserId&&sessionId?fetch("https://ab.guardianbikes.com/api/participant",{method:"POST",headers:{"Content-Type":"application/json","x-gbab":"A2K%rTtJWgY*HcYXY5Wc^4jBZpErzEEp"},body:JSON.stringify({shopifyUserId,sessionId,name:testName,variant,utmSource:utmParams?.utm_source||null,utmMedium:utmParams?.utm_medium||null,utmCampaign:utmParams?.utm_campaign||null,utmContent:utmParams?.utm_content||null,utmTerm:utmParams?.utm_term||null})}).then(response=>{if(!response.ok){console.error("Error recording A/B test participant:",response.statusText);return}return response.json()}).then(data=>{data&&console.log("A/B test participant recorded:",data)}).catch(error=>{console.error("Failed to record A/B test participant:",error)}):console.warn("Missing shopify_user_id or session_id for A/B test tracking")}function hideABTestCSS(){for(let testName in tests){let test=tests[testName];if(!test.enabled)continue;let variant=abGetLocalStorage(`gbab_${testName}`);return variant?console.log("Loaded variant"):(variant=selectRandomVariant(test),console.log("Assigned to variant",variant),setABTestGroup(testName,variant)),tests[testName].variants[variant].selectors.forEac
1h(selector=>{selector.type==="visibility"?(selector.hide&&addCSSRule(selector.hide,"display: none !important;"),selector.show&&addCSSRule(selector.show,"visibility: hidden;")):selector.element&&addCSSRule(selector.element,"visibility: hidden;")}),variant}}function hideControlCSS(){for(let testName in tests){let test=tests[testName];tests[testName].variants.A.selectors.forEach(selector=>{addCSSRule(selector.element,"visibility: hidden;")})}}function applyExcludedControl(){for(let testName in tests)applyVariant(testName,"A",!1)}function changeCartABProperties(variant){fetch("/cart?view=alternate.json").then(response=>response.json()).then(data=>{data.error===!0?console.log("error",data.error):data.items.filter(item=>item.product_type==="Kids Bikes").forEach(bike=>{const bikeProperties=bike.properties;bikeProperties._gbab!=="T001-"+variant&&(bikeProperties._gbab="T001-"+variant,fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:bike.key,properties:bikeProperties})}).then(response=>response.json()).then(cart=>{console.log("Updated cart")}).catch(error=>{console.log("Error:",error)}))})}).catch(error=>{console.log("Error:",error)})}let skipGoogle=!1,googleExclusion=abGetLocalStorage("google_exclusion"),utmSource=gbGetQueryParam("utm_source"),utmMedium=gbGetQueryParam("utm_medium"),utmCampaign=gbGetQueryParam("utm_campaign");if(skipGoogle&&(utmSource&&utmMedium&&utmCampaign||googleExclusion==1)){console.log("skipping.");let utmSourceLower=utmSource&&utmSource.toLowerCase(),utmMediumLower=utmMedium&&utmMedium.toLowerCase(),utmCampaignLower=utmCampaign&&utmCampaign.toLowerCase(),campaignContainsShopOrPmax=utmCampaign&&["p.max","shopping"].some(function(value){return utmCampaignLower.indexOf(value)!==-1});if(googleExclusion==1||utmSourceLower=="google"&&utmMediumLower=="cpc"&&campaignContainsShopOrPmax){if(hideControlCSS(),!googleExclusion)for(let testName in tests)tests[testName].enabled&&setABTestGroup(testName,"Excluded");abSetLocalStorage("google_exclusion",1),document.readyState!=="loading"?applyExcludedControl():document.addEventListener("DOMContentLoaded",()=>{applyExcludedControl()})}}else{console.log("*****");let variant=hideABTestCSS();console.log("***** variant",variant),document.readyState!=="loading"?runTests(variant):document.addEventListener("DOMContentLoaded",()=>{runTests(variant)})}
2//# sourceMappingURL=/cdn/shop/t/548/assets/gb-ab.js.map?v=19675668699695139041772562354

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.