PageSourceSearch

https://diesel.com/on/demandware.static/Sites-DieselCA-Site/-/en_C…/internal/jscript/dwanalytics-22.2.js

js diesel.com collected 2026-09-24 08:40:32 UTC 10,743 bytes, 8 lines download raw bytes

1/*!
2 * dwAnalytics - Web Analytics Tracking
3 * Based partially on Piwik
4 *
5 * @link http://piwik.org
6 * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
7 */if(typeof dw=="undefined")var dw={};typeof dw.__dwAnalyticsLoaded=="undefined"&&(dw.__dwAnalyticsLoaded=!0,dw.__dwAnalytics=function(){var MAX_URL_LENGTH=2e3,expireDateTime,plugins={},documentAlias=document,navigatorAlias=navigator,screenAlias=screen,windowAlias=window,hostnameAlias=windowAlias.location.hostname;function isDefined(property){return typeof property!="undefined"}function Tracker(trackerUrl,siteId){var configTrackerUrl=trackerUrl+"?"||"?",configCustomUrl,configTitle=documentAlias.title,browserHasCookies="0",pageReferrer,pluginMap={pdf:["pdf","application/pdf","0"],quicktime:["qt","video/quicktime","0"],realplayer:["realp","audio/x-pn-realaudio-plugin","0"],wma:["wma","application/x-mplayer2","0"],director:["dir","application/x-director","0"],flash:["fla","application/x-shockwave-flash","0"],java:["java","application/x-java-vm","0"],gears:["gears","application/x-googlegears","0"],silverlight:["ag","application/x-silverlight","0"]},linkTrackingInstalled=!1,escapeWrapper=windowAlias.encodeURIComponent||escape,unescapeWrapper=windowAlias.decodeURIComponent||unescape,registeredHooks={};function setCookie(cookieName,value,daysToExpire,path,domain,secure){var expiryDate;daysToExpire&&(expiryDate=new Date,expiryDate.setTime(expiryDate.getTime()+daysToExpire*864e5)),documentAlias.cookie=cookieName+"="+escapeWrapper(value)+(daysToExpire?";expires="+expiryDate.toGMTString():"")+";path="+(path||"/")+(domain?";domain="+domain:"")+(secure?";secure":"")}function getCookie(cookieName){var cookiePattern=new RegExp("(^|;)[ ]*"+cookieName+"=([^;]*)"),cookieMatch=cookiePattern.exec(documentAlias.cookie);return cookieMatch?unescapeWrapper(cookieMatch[2]):0}function getImage(urls){dw.__timeoutCallback=function(){for(var i2=0;i2<urls.length;i2++){var image=new Image(1,1);image.onLoad=function(){},image.src=urls[i2]}},setTimeout(dw.__timeoutCallback,100)}function detectBrowserPlugins(){var i2,mimeType;if(typeof navigatorAlias.javaEnabled!="undefined"&&navigatorAlias.javaEnabled()&&(pluginMap.java[2]="1"),typeof windowAlias.GearsFactory=="function"&&(pluginMap.gears[2]="1"),navigatorAlias.mimeTypes&&navigatorAlias.mimeTypes.length)for(i2 in pluginMap)mimeType=navigatorAlias.mimeTypes[pluginMap[i2][1]],mimeType&&mimeType.enabledPlugin&&(pluginMap[i2][2]="1")}function getReferrer(){var referrer="";try{referrer=top.document.referrer}catch(e){if(parent)try{referrer=parent.document.referrer}catch(e2){referrer=""}}return referrer===""&&(referrer=documentAlias.referrer),referrer}function hasCookies(){var testCookieName="_pk_testcookie";return isDefined(navigatorAlias.cookieEnabled)?navigatorAlias.cookieEnabled?"1":"0":(setCookie(testCookieName,"1"),getCookie(testCookieName)=="1"?"1":"0")}function logPageView(analyticsContext,collectedData,customTitle){var id=Math.random(),tuples=constructDataSet(analyticsContext,collectedData,customTitle,id);if(collectedData!=null&&collectedData.debugEnabled){for(var text="",i2=0;i2<tuples.length;i2++)text+=tuples[i2][0]+'"='+tuples[i2][1]+`"
8`;alert(text)}var urls=createUrls(analyticsContext,configTrackerUrl,tuples,id);getImage(urls)}pageReferrer=getReferrer(),browserHasCookies=hasCookies(),detectBrowserPlugins();try{process_anact_cookie()}catch(err){}return{trackPageView:function(customTitle){logPageView(null,null,customTitle)},trackPageViewWithProducts:function(analyticsContext,collectedData,customTitle){logPageView(analyticsContext,collectedData,customTitle)}};function appendToRequest(tuple,request){var beginningChar=request.charAt(request.length-1)=="?"?"":"&";return request+beginningChar+tuple[0]+"="+tuple[1]}function lengthOfTuple(tuple){return tuple[0].length+tuple[1].length+2}function constructDataSet(analyticsContext,collectedData,customTitle,id){var tuples=[["url",escapeWrapper(isDefined(configCustomUrl)?configCustomUrl:documentAlias.location.href)],["res",screenAlias.width+"x"+screenAlias.height],["cookie",browserHasCookies],["ref",escapeWrapper(pageReferrer)],["title",escapeWrapper(isDefined(customTitle)&&customTitle!=null?customTitle:configTitle)]];for(var index in pluginMap)tuples.push([pluginMap[index][0],pluginMap[index][2]]
8);return analyticsContext!=null&&analyticsContext.dwEnabled&&(tuples.push(["dwac",id]),tuples.push(["cmpn",analyticsContext.sourceCode]),tuples.push(["tz",analyticsContext.timeZone]),analyticsContext.category=dw.ac._category,dw.ac._searchData&&(analyticsContext.searchData=dw.ac._searchData),addProducts(analyticsContext,collectedData,tuples)),tuples}function addProducts(analyticsContext,collectedData,tuples){tuples.push(["pcc",analyticsContext.siteCurrency]),tuples.push(["pct",analyticsContext.customer]),tuples.push(["pcat",analyticsContext.category]),analyticsContext.searchData&&(analyticsContext.searchData.q&&tuples.push(["pst-q",analyticsContext.searchData.q]),analyticsContext.searchData.searchID&&tuples.push(["pst-id",analyticsContext.searchData.searchID]),analyticsContext.searchData.refs&&tuples.push(["pst-refs",analyticsContext.searchData.refs]),analyticsContext.searchData.sort&&tuples.push(["pst-sort",analyticsContext.searchData.sort]),analyticsContext.searchData.persd!=null&&tuples.push(["pst-pers",analyticsContext.searchData.persd]),analyticsContext.searchData.imageUUID&&tuples.push(["pst-img",analyticsContext.searchData.imageUUID]),analyticsContext.searchData.suggestedSearchText&&tuples.push(["pst-sug",analyticsContext.searchData.suggestedSearchText]),analyticsContext.searchData.locale&&tuples.push(["pst-loc",analyticsContext.searchData.locale]),analyticsContext.searchData.queryLocale&&tuples.push(["pst-qloc",analyticsContext.searchData.queryLocale]),analyticsContext.searchData.showProducts!=null&&tuples.push(["pst-show",analyticsContext.searchData.showProducts]));for(var pies=collectedData.productImpressions.getEntries(),pres=collectedData.productRecommendations.getEntries(),pves=collectedData.productViews.getEntries(),count=0,i2=0;i2<pies.length;i2++)tuples.push(["pid-"+count,pies[i2].value.id]),tuples.push(["pev-"+count,"event3"]),count++;for(var j=0;j<pres.length;j++)tuples.push(["pid-"+count,pres[j].value.id]),tuples.push(["pev-"+count,"event3"]),tuples.push(["evr4-"+count,"Yes"]),count++;for(var k=0;k<pves.length;k++)tuples.push(["pid-"+count,pves[k].value.id]),tuples.push(["pev-"+count,"event4"]),count++}function createUrls(analyticsContext,configTrackerUrl2,tuples,id){for(var urls=[],request=configTrackerUrl2,i2=0;i2<tuples.length;i2++){var nextTupleIsProductAndWouldMakeRequestTooLong=tuples[i2][0].slice(0,4)=="pid-"&&lengthOfTuple(tuples[i2])+(i2+1<tuples.length?lengthOfTuple(tuples[i2+1]):0)+(i2+2<tuples.length?lengthOfTuple(tuples[i2+2]):0)+request.length>MAX_URL_LENGTH,nextTupleIsNotProductAndWouldMakeRequestTooLong=tuples[i2][0].slice(0,4)!="pid-"&&lengthOfTuple(tuples[i2])+request.length>MAX_URL_LENGTH;(nextTupleIsProductAndWouldMakeRequestTooLong||nextTupleIsNotProductAndWouldMakeRequestTooLong)&&(urls.push(request),request=appendToRequest(["dwac",id],configTrackerUrl2),analyticsContext!=null&&analyticsContext.dwEnabled&&(request=appendToRequest(["cmpn",analyticsContext.sourceCode],request),request=appendToRequest(["tz",analyticsContext.timeZone],request),request=appendToRequest(["pcc",analyticsContext.siteCurrency],request),request=appendToRequest(["pct",analyticsContext.customer],request),request=appendToRequest(["pcat",analyticsContext.category],request),analyticsContext.searchData&&(analyticsContext.searchData.q&&appendToRequest(["pst-q",analyticsContext.searchData.q],request),analyticsContext.searchData.searchID&&appendToRequest(["pst-id",analyticsContext.searchData.searchID],request),analyticsContext.searchData.refs&&appendToRequest(["pst-refs",JSON.stringify(analyticsContext.searchData.refs)],request),analyticsContext.searchData.sort&&appendToRequest(["pst-sort",JSON.stringify(analyticsContext.searchData.sort)],request),analyticsContext.searchData.persd!=null&&appendToRequest(["pst-pers",analyticsContext.searchData.persd],request),analyticsContext.searchData.imageUUID&&appendToRequest(["pst-img",analyticsContext.searchData.imageUUID],request),analyticsContext.searchData.suggestedSearchText&&appendToRequest(["pst-sug",analyticsContext.searchData.suggestedSearchText],request),analyticsContext.searchData.locale&&appendToRequest(["pst-loc",analyticsContext.searchData.locale],request),analyticsContext.searchData.queryLocale&&appendToRequest(["pst-qloc",analyticsContext.searchData.queryLocale],request),analyticsContext.searchData.showProducts!=null&&appendToRequest(["pst-show",analyticsContext.searchData.showProducts],request)))),request=appendToRequest(tuples[i2],request)}var doNotFollowCookieValue=getCookie("dw_dnt");return doNotFollowCookieValue===0||doNotFollowCookieValue===""||doNotFollowCookieValue===null||doNotFollowCookieValue===!1||(request=appendToRequest(["dw_dnt",doNotFollowCookieValue],request)),urls.push(request),urls}}function extractCookieValueAndRemoveCookie(cookieName){var cookieValue=extractEncodedCookieValue(cookieName);return cookieValue&&(document.cookie=cookieName+"=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT;"),cookieValue}function extractEncodedCookieValue(cookieName){return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(cookieName).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1").replace(/\+/g,"%20"))||null}function process_anact_cookie(){if(dw.ac){if(dw.ac._anact=extractCookieValueAndRemoveCookie("__anact"),dw.ac._anact&&!dw.ac.eventsIsEmpty())return;if(dw.ac._anact_nohit_tag||dw.ac._anact){var unescaped=dw.ac._anact_nohit_tag?dw.ac._anact_nohit_tag:dw.ac._anact,jsonPayload=JSON.parse(unescaped);if(jsonPayload){var payload=Array.isArray(jsonPayload)?jsonPayload[0]:jsonPayload;if(payload&&payload.activityType=="viewSearch"&&payload.parameters){var params=payload.parameters,search_params={};search_params.q=params.searchText,search_params.suggestedSearchText=params.suggestedSearchText,search_params.persd=params.personalized,search_params.refs=params.refinements,search_params.sort=params.sorting_rule,search_params.imageUUID=params.image_uuid,search_params.showProducts=params.showProducts,search_params.searchID=params.searchID,search_params.locale=params.locale,search_params.queryLocale=params.queryLocale,dw.ac.applyContext({searchData:search_params});var products=params.products;if(products&&Array.isArray(products))for(i=0;i<products.length;i++)products[i]&&dw.ac._capture({id:products[i].id,type:dw.ac.EV_PRD_SEARCHHIT})}}}}}return{getTracker:function(analyticsUrl){return new Tracker(analyticsUrl)}}}());

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.