1// console.log("é¶ä»¶å¨é"); 2var langValue = $("html").attr("lang"); 3var processedOrderCodes = []; 4var CoinType="TWD"; 5 // var language = typeof lang !== "undefined" && lang !== 0 ? lang : "TW"; 6 var userEmail = typeof UserData !== "undefined" && UserData.email ? UserData.email : null; 7 var userPhone = typeof UserData !== "undefined" && UserData.phone ? UserData.phone : null; 8 9// let isPurchaseInfoExecuted = false;//æ¨è¨äºä»¶ååå¨ 10 11// if (langValue === "zh-TW") { 12// CoinType = "TWD"; 13// } else if (langValue === "en") { 14// CoinType = "USD"; 15// } else if (langValue === "jp") { 16// CoinType = "JPY"; 17// } else if (langValue === "kr") { 18// CoinType = "KRW"; 19// } else if (langValue === "fr") { 20// CoinType = "EUR"; 21// } else { 22// CoinType = "å ¶ä»å¼"; 23// } 24var MemXmlID = "unknown"; 25 26 27//å¿é¡æ¸ å® å å ¥è³¼ç©è»XXå°æªå®æ 28// let addToCartwish = (e) => { 29// console.log("å¿é¡æ¸ å® å å ¥è³¼ç©è»"); 30// e.preventDefault(); 31// var xiValue = $(e.currentTarget).attr("xi"); 32// console.log("xiValue", xiValue); 33// // æ ¹æ xi 弿¾å°ç¸å°æçååç·¨èåååå稱 34// var productCode = $('.MobliePrdCode[xi="' + xiValue + '"]') 35// .find("nobr") 36// .text(); 37// console.log("productCode", productCode); 38 39// // æ¾å°å¿é¡æ¸ å®å ç´ ä¸¦ç²å vdrCodeValue 40// // var vdrCodeValue = $(e.currentTarget).closest('tr').find('.faveaddcart').attr('data-vdrcode'); 41// // console.log("vdrCodeValue", vdrCodeValue); 42 43// var productNameTwish = $('.MobliePrdName a[xi="' + xiValue + '"]').text(); 44// console.log("productNameTwish", productNameTwish); 45// var PrdPrice = $(e.currentTarget).data("price"); 46 47// console.log("PrdPrice", PrdPrice); 48 49// window.dataLayer = window.dataLayer || []; 50// window.dataLayer.push({ 51// event: "GaEvent", 52// custom_label: "AddToCart", 53// ecommerce: { 54// contents: [ 55// { 56// id: productCode, 57// name: productNameTwish, 58// quantity: 1, 59// value: PrdPrice, 60// category:null, 61// category2: null, 62// brand: null, 63// currency: CoinType, 64// }, 65// ], 66// }, 67// }); 68// }; 69let addToCartwish = (e) => { 70 e.preventDefault(); // Prevent the default anchor tag behavior 71 72 // Retrieve the xi value from the clicked element 73 var xiValue = $(e.currentTarget).attr("xi"); 74// console.log("xiValue", xiValue); 75 76 // Assuming the clicked element is within the same row as the product details 77 // Traverse up to the closest 'tr' (table row) and then find the specific elements within that row 78 var $row = $(e.currentTarget).closest('tr'); 79 80 // Now find the product code and name within that row using your class identifiers 81 var productCode = $row.find('.MobliePrdCode nobr').text(); 82// console.log("productCode", productCode); 83 84 var productNameTwish = $row.find('.MobliePrdName a').text(); 85// console.log("productNameTwish", productNameTwish); 86 87 // Retrieve the product price from the data-price attribute of the clicked element 88 // var PrdPrice = $(e.currentTarget).data("price"); 89 var PrdPrice = Number($(e.currentTarget).data("price")); 90 console.log("PrdPrice", PrdPrice); 91 92 // Push the gathered details to your dataLayer for tracking 93 window.dataLayer = window.dataLayer || []; 94 window.dataLayer.push({ ecommerce: null }); 95 window.dataLayer.push({ 96 event: "GaEvent", 97 custom_label: "AddToCart", 98 ecommerce: { 99 id: productCode, 100 name: productNameTwish, 101 quantity: 1, 102 value: PrdPrice, 103 category: null, 104 category2: null, 105 brand: null, 106 currency: CoinType, 107 }, 108 }); 109}; 110//ç¢åé å å ¥è³¼ç©è» ok ç£è½æéSaleBtn1 111let addToCartprdinfo = (e) => { 112// console.log("ç¢åé å å ¥è³¼ç©è»"); 113 e.preventDefault(); 114 var xmlid = $(e.currentTarget).closest('.rtBuyNow').attr("xi"); 115 var productinfoName = $(e.currentTarget).closest('.rtBuyNow').attr("data-name"); 116 var qtyValue = $(".qty").val(); 117// console.log("qtyValue", qtyValue); 118// console.log("xmlid", xmlid);
119// console.log("productinfoName", productinfoName); 120 // var vdrCodeValue = $('.vdrCode').text(); 121 var vdrCodeValue = $("#PrdInfo_" + xmlid).attr("prd"); 122// console.log("vdrCodeValue", vdrCodeValue); 123 var resultvdrCodeValue = vdrCodeValue.replace("$VdrCode$", ""); 124// console.log("resultvdrCodeValue", resultvdrCodeValue); 125PrdPrice = parseFloat(PrdPrice); 126 127 window.dataLayer = window.dataLayer || []; 128 window.dataLayer.push({ ecommerce: null }); 129 window.dataLayer.push({ 130 event: "GaEvent", 131 custom_label: "AddToCart", 132 ecommerce: { 133 id: resultvdrCodeValue, 134 name: productinfoName, //缺 135 quantity: qtyValue, 136 value: PrdPrice, //æ£ç¢ºå¿å 137 category:null, 138 category2: null, 139 brand: null, 140 currency: CoinType, 141 }, 142 }); 143}; 144//æéçºPrdBtn 145// let addToCartprdinfo = (e) => { 146// console.log("ç¢åé å å ¥è³¼ç©è»"); 147// e.preventDefault(); 148// var xmlid = $(e.currentTarget).attr("xi"); 149// var productinfoName = $(e.currentTarget).attr("data-name"); 150// var qtyValue = $(".qty").val(); 151// console.log("qtyValue", qtyValue); 152// console.log("xmlid", xmlid); 153// console.log("productinfoName", productinfoName); 154// // var vdrCodeValue = $('.vdrCode').text(); 155// var vdrCodeValue = $("#PrdInfo_" + xmlid).attr("prd"); 156// console.log("vdrCodeValue", vdrCodeValue); 157// var resultvdrCodeValue = vdrCodeValue.replace("$VdrCode$", ""); 158// console.log("resultvdrCodeValue", resultvdrCodeValue); 159 160// window.dataLayer = window.dataLayer || []; 161// window.dataLayer.push({ 162// event: "GaEvent", 163// custom_label: "AddToCart", 164// ecommerce: { 165// id: resultvdrCodeValue, 166// name: productinfoName, //缺 167// quantity: qtyValue, 168// value: PrdPrice, //æ£ç¢ºå¿å 169// category:null, 170// category2: null, 171// brand: null, 172// currency: CoinType, 173// }, 174// }); 175// }; 176//ç¢åé ä½ å¯è½æèè¶£å å ¥è³¼ç©è» 宿 177let addTointerestCartprdinfo = (e) => { 178 e.stopPropagation();
179// console.log("ç¢åé ä½ å¯è½æèè¶£å å ¥è³¼ç©è»"); 180 let $main = $(e.currentTarget).closest(".PrdCell"); 181 let xiValue2 = $main.attr("xi"); 182// console.log("xiValue2", xiValue2); 183 // ä½¿ç¨ xi 弿¥æ¾å°æçå ç´ 184 let productCode2 = $main.attr("prd"); 185// console.log("productCode", productCode2); 186 187 let productName2 = $main.find(".PrdTitle").text(); 188// console.log("productName2", productName2); 189 190 // åå¾ PrdPrice çå¼ 191 let PrdPrice2 = $main.find(".PrdPriceAmt").text(); 192 let PrdDisPrice = $main.find(".PrdDisPriceAmt").text(); 193 // PrdPrice2 = PrdDisPrice.length ? PrdDisPrice : PrdPrice2; 194 // PrdPrice2 = PrdDisPrice.length ? PrdDisPrice.replace(/,/g, "") : PrdPrice2.replace(/,/g, ""); 195 PrdPrice2 = PrdDisPrice.length ? parseFloat(PrdDisPrice.replace(/,/g, "")) : parseFloat(PrdPrice2.replace(/,/g, "")); 196// console.log("èè¶£PrdPrice", PrdPrice2); 197 198 window.dataLayer = window.dataLayer || []; 199 window.dataLayer.push({ ecommerce: null }); 200 window.dataLayer.push({ 201 event: "GaEvent", 202 custom_label: "AddToCart", 203 ecommerce: { 204 id: productCode2, 205 name: productName2, //缺 206 quantity: 1, 207 value: PrdPrice2, //æ£ç¢ºå¿å 208 category:null, 209 category2: null, 210 brand: null, 211 currency: CoinType, 212 213 }, 214 }); 215}; 216//ç£è½æéç¢åé ç覽åå 217 // let prdinfoview = (e) => { 218 // console.log("éç¢åé ç覽åå"); 219 // var viewcode = $(".vdrCode").text(); 220 // var xiValue = $(".divPrdInfo").attr("xi"); 221 // console.log("xiValue", xiValue); 222 // var vdrCodeValueview = $("#PrdInfo_"+ xiValue).attr("prd"); 223 // console.log("vdrCodeValueview", vdrCodeValueview); 224 // // var resultvdrCodeview = vdrCodeValueview.replace("$VdrCode$", ""); 225 // // console.log("resultvdrCodeview",resultvdrCodeview); 226 227 // // var priceAmtValue = $('#meMsg_41427_MsgPrdPriceAmt').text(); 228 // var PrdName = $('.rtBuyNow.PrdBtn:not([data-name="$PrdTitle$"])').attr( 229 // "data-name" 230 // ); 231 232 // console.log(" PrdName çå¼çº:", PrdName); 233 // console.log(" PrdPrice çå¼çº:", PrdPrice); 234 235 // window.dataLayer = window.dataLayer || []; 236 // window.dataLayer.push({ ecommerce: null }); 237 // window.dataLayer.push({ 238 // event: "GaEvent", 239 // custom_label: "ViewContent", 240 // ecommerce: { 241 // id: vdrCodeValueview, 242 // name: PrdName, //缺 243 // value: PrdPrice, 244 // category:null, 245 // category2: null, 246 // category3: null, 247 // brand: null, 248 // currency: CoinType, 249 // }, 250 // }); 251 // }; 252 let prdinfoview = () => { 253 // console.log("éç¢åé ç覽åå"); 254 255 // å ¶ä»åå§å代碼... 256 var xiValue = $(".divPrdInfo").attr("xi"); 257 // console.log("xiValue", xiValue); 258 259 // ä½¿ç¨ MutationObserver ç£è½ DOM è®å 260 let observer = new MutationObserver((mutations, obs) => { 261 var vdrCodeValueview = $("#PrdInfo_" + xiValue).attr("prd"); 262 if (vdrCodeValueview) { 263 // console.log("vdrCodeValueview", vdrCodeValueview); 264 let PrdName = $('.rtBuyNow.PrdBtn:not([data-name="$PrdTitle$"])').attr("data-name"); 265 // console.log("PrdName çå¼çº:", PrdName); 266 // ç¢ºä¿ PrdPrice éåè®éå¨é裡æ¯å·²å®ç¾©ä¸æå¼ç 267 // console.log("PrdPrice çå¼çº:", PrdPrice); 268 269 window.dataLayer = window.dataLayer || []; 270 window.dataLayer.push({ ecommerce: null }); 271 window.dataLayer.push({ 272 event: "GaEvent", 273 custom_label: "ViewContent", 274 ecommerce: { 275 id: vdrCodeValueview, 276 name: PrdName, 277 value: PrdPrice, 278 category: null, 279 category2: null, 280 category3: null, 281 brand: null, 282 currency: CoinType, 283 }, 284 }); 285 286 // 忢ç£è½ 287 obs.disconnect(); 288 } 289 }); 290 291 observer.observe(document.body, { 292 childList: true, 293 subtree: true 294 });
295 }; 296//ç£è½ç¢åç®éé å å ¥è³¼ç©è» 宿 297let addToCartprdlist = (e) => { 298// console.log("ç®éé å å ¥è³¼ç©è»"); 299 e.preventDefault(); 300 var xmlid = $(e.currentTarget).attr("xi"); 301 var productlistName = $(e.currentTarget).attr("data-name"); 302 var prdValue = $("#PrdInfo_" + xmlid).attr("prd"); 303 var priceAmtElement = $("#meMsg_" + xmlid + "_MsgPrdPriceAmt"); 304 var priceAmtValue = priceAmtElement.attr("priceamt"); 305var priceAmtNumber = parseFloat(priceAmtValue); 306 // var productId =priceAmtElement.attr('priceamt'); 307 308// console.log("priceAmtValue", priceAmtValue); 309// console.log("xmlid", xmlid); 310// console.log("prdValue", prdValue); 311// console.log("productlistName", productlistName); 312 313 window.dataLayer = window.dataLayer || []; 314 window.dataLayer.push({ ecommerce: null }); 315 window.dataLayer.push({ 316 event: "GaEvent", 317 custom_label: "AddToCart", 318 ecommerce: { 319 id: prdValue || "anonymous", 320 name: productlistName, 321 quantity: 1, 322 value: priceAmtNumber, 323 category:null, 324 category2: null, 325 category3: null, 326 brand: null, 327 currency: CoinType, 328 }, 329 }); 330}; 331//ç£è½ç¢åç®éé ç覽ç´é å å ¥è³¼ç©è» 宿 332let historyAddCartevent = (e) => { 333// console.log("ç®éé ç覽ç´é å å ¥è³¼ç©è»äºä»¶"); 334 e.preventDefault(); 335 336 e.preventDefault(); 337 338 var xiValue = $(e.currentTarget).find("img").attr("xi"); 339// console.log("xiValue", xiValue); 340 341 var prdValue = $(`#PrdInfo_${xiValue}`).attr("prd"); 342// console.log("prdValue", prdValue); 343 344 var prdTitleName = $(`#PrdInfo_${xiValue} .PrdTitle`).attr("title"); 345// console.log("prdTitleName", prdTitleName); 346 347 var prdPricehistoryValue = $(`#PrdInfo_${xiValue} .PrdPrice`).text().trim(); 348// console.log("prdPricehistoryValue", prdPricehistoryValue); 349 350 var ntAmount = prdPricehistoryValue.split("NT$")[1].split("US$")[0].trim(); 351 var ntAmountNumber = parseFloat(ntAmount); 352// console.log("ntAmount", ntAmount); 353 354 window.dataLayer = window.dataLayer || []; 355 window.dataLayer.push({ ecommerce: null }); 356 window.dataLayer.push({ 357 event: "GaEvent", 358 custom_label: "AddToCart", 359 ecommerce: { 360 id: prdValue || "anonymous", 361 name: prdTitleName, 362 quantity: 1, 363 value: ntAmountNumber, 364 category:null, 365 category2: null, 366 category3: null, 367 brand: null, 368 currency: CoinType, 369 }, 370 }); 371}; 372//ç¢åèè¶£ 373// let addToCartprdinterest = (e) => {
374// console.log("æåç£è½ç¢åèè¶£xxx"); 375// e.preventDefault(); 376// var xmlid = $(e.currentTarget).attr("xi"); 377// var productName = $(e.currentTarget).attr("data-name"); 378// var priceAmtElement = $('#meMsg_' + xmlid + '_MsgPrdPriceAmt'); 379// var priceAmtValue = priceAmtElement.attr('priceamt'); 380 381// console.log("priceAmtValue", priceAmtValue); 382// console.log("xmlid",xmlid); 383// // console.log("PrdPriceElement",PrdPriceElement); 384// console.log("productName",productName); 385 386// window.dataLayer = window.dataLayer || []; 387// window.dataLayer.push({ 388// 'event': 'GaEvent', 389// 'custom_label': 'AddToCart', 390// 'ecommerce': { 391// contents: [{ 392// 'id': xmlid, 393// 'name': productName, 394// 'quantity': 1, 395// 'value': priceAmtValue, 396// 'category': 'é¡å¥', 397// 'category2': 'åé¡å¥', 398// 'brand': 'åçå稱', 399// 'currency': CoinType 400// }] 401// } 402// }); 403// } 404//使ç¨è è³è¨ 405// window.onload = function () { 406// console.log("memè¼å ¥"); 407// var htmlElement = document.querySelector("html"); 408// var language = lang !== 0 ? lang : "TW"; 409// var userEmail = UserData.email; 410// var userPhone = UserData.phone; 411// var NpmUserData = { 412// user_id: MemXmlID || "anonymous", //å®ç¾©çºanonymousæ¾ä¸å° 413// phone: userPhone || null, 414// email: userEmail || null, 415// language: CoinType || null, 416// }; 417 418// window.dataLayer = window.dataLayer || []; 419// window.dataLayer.push(NpmUserData); 420// console.log("NpmUserData", NpmUserData); 421// }; 422// var NpmUserData; 423 // window.onload = function () { 424 425 // NpmUserData = { 426 // user_id: typeof MemXmlID !== "undefined" && MemXmlID ? MemXmlID : "anonymous", 427 // phone: typeof userPhone !== "undefined" ? userPhone : null, 428 // email: typeof userEmail !== "undefined" ? userEmail : null, 429 // language: typeof CoinType !== "undefined" && CoinType ? CoinType : "defaultLanguage" 430 // }; 431 432 433 // console.log("NpmUserData updated after 5 seconds", NpmUserData); 434 435 // }; 436//ç¢åç®éé -å å ¥å¿é¡æ¸ å® 437let addToWishprdlist = (e) => { 438// console.log("ç¢åç®éé -å å ¥å¿é¡æ¸ å®"); 439 e.preventDefault(); 440 441 var xiValue = $(e.currentTarget).attr("xi"); 442// console.log("xiValue " + xiValue); 443 444 var prdValue = $(`#PrdInfo_${xiValue}`).attr("prd"); 445// console.log("prdValue", prdValue); 446 447 var prdTitleName = $(`#PrdInfo_${xiValue} .PrdTitle .PrdTitleText a`).attr( 448 "title" 449 ); 450// console.log("prdTitleName", prdTitleName); 451 452 var prdPricehistoryValue = $(`#PrdInfo_${xiValue} .PrdPrice`).text().trim(); 453 454 var ntAmount = prdPricehistoryValue.split("NT$")[1].split("US$")[0].trim().replace(/[^0-9]/g, ''); 455// console.log("ntAmount", ntAmount); 456 457 window.dataLayer = window.dataLayer || []; 458 window.dataLayer.push({ ecommerce: null }); 459 window.dataLayer.push({ 460 event: "GaEvent", 461 custom_label: "AddToWishlist", 462 ecommerce: { 463 id: prdValue, //ååç·¨è 464 name: prdTitleName, //ååå稱 465 value: ntAmount, //åå广 ¼ 466 category:null, 467 category2: null, 468 category3: null, 469 brand: null, 470 currency: CoinType, 471 }, 472 }); 473}; 474//ç¢åè³è¨-å å ¥å¿é¡æ¸ å® 475let addToWishprdinfo = (e) => { 476// console.log("ç¢åè³è¨é -å å ¥å¿é¡æ¸ å®"); 477 var viewToWishprdinfocode = $(".vdrCode").text(); 478 let xiValue = $(".divPrdInfo").attr("xi"); 479// console.log("xiValue", xiValue); 480 var vdrCodeValueview = $("#PrdInfo_" + xiValue).attr("prd"); 481 console.log("vdrCodeValueview", vdrCodeValueview); 482 var resultvdrCodeview = vdrCodeValueview.replace("$VdrCode$", ""); 483// console.log("resultvdrCodeview", resultvdrCodeview); 484 485 // var priceAmtValue = $('#meMsg_41427_MsgPrdPriceAmt').text(); 486 var PrdNameToWishprdinf = $(
487 '.rtBuyNow.PrdBtn:not([data-name="$PrdTitle$"])' 488 ).attr("data-name"); 489 490 window.dataLayer = window.dataLayer || []; 491 window.dataLayer.push({ ecommerce: null }); 492 window.dataLayer.push({ 493 event: "GaEvent", 494 custom_label: "AddToWishlist", 495 ecommerce: { 496 id: resultvdrCodeview, //ååç·¨è 497 name: PrdNameToWishprdinf, //ååå稱 498 value: PrdPrice, //åå广 ¼ 499 category:null, 500 category2: null, 501 category3: null, 502 brand: null, 503 currency: CoinType, 504 }, 505 }); 506}; 507 508//InitiateCheckoutï¼éå§çµå¸³ç«é¢ï¼ 509let InitiateCheckout = (e) => { 510// console.log("éå§çµå¸³ç«é¢"); 511 if (e) { 512 e.preventDefault(); 513 } 514 var ordertotalamtValue; 515 var ordertotalamtValue2;//é»åæ¸ç¸½éé¡ 516 $("#cenShowList1").each(function() { 517 518 ordertotalamtValue = $(this).find(".spanOrderTotalAmt").text().replace(/,/g, ''); 519 // console.log("ordertotalamtValue", ordertotalamtValue); 520 521}); 522$("#cenShowList2").each(function() { 523 524 ordertotalamtValue2 = $(this).find(".spanOrderTotalAmt").text().replace(/,/g, ''); 525// console.log("ordertotalamtValue2", ordertotalamtValue2); 526 527}); 528 // console.log("prdTotalAmtElement",prdTotalAmtElement); 529 // console.log("langValue",langValue); 530 // console.log("ordercode",orderCode); 531 532 // åµå»ºä¸åæ¸çµä¾åå²ååè©³ç´°ä¿¡æ¯ 533 var products = []; 534 var products2 = []; 535 // éæ·å ·æâShopListNameâé¡çç¢åå ç´ 536 $("#cenShowList1 .ShopListName").each(function (index) { 537 var prdcode = $(this).closest("tr").find(".ShopListPrdCode").text(); // çæå¯ä¸çç¢åID 538 var productName = $(this).text(); // ç²åç¢åå稱 539 var productQuantity = 540 parseInt($(this).closest("tr").find(".qty").attr("qty")) || 1; // æ¨å¯ä»¥æ ¹æéè¦ä¿®æ¹éåå¼ 541 var productValue = 542 parseFloat($(this).closest("tr").find(".ShopListPrice").text().replace(/,/g, '')) || 0; 543 // console.log("productValue",productValue); 544 545 // å°ç¢åè©³ç´°ä¿¡æ¯æ·»å å°æ¸çµä¸ 546 products.push({ 547 id: prdcode, 548 name: productName, 549 quantity: productQuantity, 550 value: productValue, 551 category:null, 552 category2: null, 553 category3: null, 554 brand: null, 555 }); 556 }); 557 $("#cenShowList2 .ShopListName").each(function (index) { 558 var prdcode2 = $(this).closest("tr").find(".ShopListPrdCode").text(); // çæå¯ä¸çç¢åID 559 var productName2 = $(this).text(); // ç²åç¢åå稱 560 var productQuantity2 = 561 parseInt($(this).closest("tr").find(".qty").attr("qty")) || 1; // æ¨å¯ä»¥æ ¹æéè¦ä¿®æ¹éåå¼ 562 var productValue2 = 563 parseFloat($(this).closest("tr").find(".ShopListPrice").text().replace(/,/g, '')) || 0; 564 // console.log("productValue2",productValue2); 565 566 // å°ç¢åè©³ç´°ä¿¡æ¯æ·»å å°æ¸çµä¸ 567 products2.push({ 568 id: prdcode2, 569 name: productName2, 570 quantity: productQuantity2, 571 value: productValue2, 572 category:null, 573 category2: null, 574 category3: null, 575 brand: null, 576 }); 577 }); 578 // å°å å«åå詳細信æ¯çæ¸çµæ¨éå°dataLayerä¸ 579 window.dataLayer = window.dataLayer || []; 580 window.dataLayer.push({ ecommerce: null }); 581 window.dataLayer.push({ 582 event: "GaEvent", 583 custom_label: "InitiateCheckout", 584 ecommerce: { 585 amount: ordertotalamtValue, //çµå¸³ç¸½éé¡ 586 value: ordertotalamtValue, //çµå¸³ç¸½éé¡ 587 currency: CoinType, //å¹£å¥(exï¼TWD) 588 contents: products, 589 }, 590 }); 591 //é»åæ¸åå¡ 592 window.dataLayer = window.dataLayer || []; 593 window.dataLayer.push({ ecommerce: null }); 594 window.dataLayer.push({ 595 event: "GaEvent", 596 custom_label: "InitiateCheckout", 597 ecommerce: { 598 amount: ordertotalamtValue2, //çµå¸³ç¸½éé¡ 599 value: ordertotalamtValue2, //çµå¸³ç¸½éé¡ 600 currency: CoinType, //å¹£å¥(exï¼TWD) 601 contents: products2, 602 }, 603 }); 604}; 605 606 607 608//AddPaymentInfoï¼å¡«å¯«ä»æ¬¾è³è¨ï¼ 609let AddPaymentInfo = (e) => { 610// console.log("éå§å¡«å¯«ä»æ¬¾è³è¨"); 611 if (e) { 612 e.preventDefault(); 613 } 614 var AddPaymentamt = $(".spanOrderTotalAmt").text().replace(/,/g,''); 615// console.log("AddPaymentamt", AddPaymentamt); 616 617 var langValue = $("html").attr("lang"); 618 // console.log("prdTotalAmtElement",prdTotalAmtElement); 619 // console.log("langValue",langValue); 620 // console.log("ordercode",orderCode); 621 622 var products = []; 623 624 // éæ·å ·æâShopListNameâé¡çç¢åå ç´ 625 $(".ShopListName").each(function (index) { 626 var prdcode = $(this).closest("tr").find(".ShopListPrdCode").text(); 627 var productName = $(this).text(); // ç²åç¢åå稱 628 var productQuantity = 629 parseInt($(this).closest("tr").find(".qty").attr("qty")) || 1; // æ¨å¯ä»¥æ ¹æéè¦ä¿®æ¹éåå¼ 630 var productValue = 631 parseFloat($(this).closest("tr").find(".ShopListPrice").text().replace(/,/g, '')) || 0; 632 // var productCategory = ''; 633 // var productCategory2 = ''; 634 // var productCategory3 = ''; 635 // var productBrand = ''; 636 637 // å°ç¢åè©³ç´°ä¿¡æ¯æ·»å å°æ¸çµä¸ 638 products.push({ 639 id: prdcode, 640 name: productName, 641 quantity: productQuantity, 642 value: productValue, 643 category:null, 644 category2: null, 645 category3: null, 646 brand: null, 647 });
648 }); 649 650 window.dataLayer = window.dataLayer || []; 651 window.dataLayer.push({ ecommerce: null }); 652 window.dataLayer.push({ 653 event: "GaEvent", 654 custom_label: "AddPaymentInfo", 655 ecommerce: { 656 amount: AddPaymentamt, //çµå¸³ç¸½éé¡ 657 value: AddPaymentamt, //çµå¸³ç¸½éé¡ 658 currency: CoinType, //å¹£å¥(exï¼TWD) 659 contents: products, 660 }, 661 }); 662}; 663 664//Purchaseï¼è³¼è²·å®æï¼ 665let Purchaseinfo = (e) => { 666 var orderCodeValue = $("#ordercode").text(); 667 // è®åå·²èççè¨å®ç·¨èå表 668 var processedOrderCodes = 669 JSON.parse(localStorage.getItem("processedOrderCodes")) || []; 670 671 // æª¢æ¥æ¯å¦å·²ç¶èçééåè¨å®ç·¨è 672 if (processedOrderCodes.includes(orderCodeValue)) { 673 // console.log("Order Code already processed: ", orderCodeValue); 674 return; 675 } 676 677 processedOrderCodes.push(orderCodeValue); // å°ç¶åè¨å®ç·¨èå å ¥å·²èçæ¸ å® 678 679 // å¯«å ¥ localStorage 680 localStorage.setItem( 681 "processedOrderCodes", 682 JSON.stringify(processedOrderCodes) 683 ); 684 685// console.log("ç¶åè¨å®ç·¨è ", processedOrderCodes); 686// console.log("Order Code: ", orderCodeValue); 687 688 if (e) { 689 e.preventDefault(); 690 } 691 692// console.log("è³¼è²·å®æé é¢"); 693 var prdTotalAmtElement = $("#ordertotalamt").text(); 694 var orderCode = $("#ordercode").text(); 695 // var langValue = $("html").attr("lang"); 696 697 // åµå»ºä¸åæ¸çµä¾åå²ååè©³ç´°ä¿¡æ¯ 698 var products = []; 699 700 // console.log("prdTotalAmtElement",prdTotalAmtElement); 701 // console.log("langValue",langValue); 702 // console.log("ordercode",orderCode); 703 704 // éæ·å ·æâShopListNameâé¡çç¢åå ç´ 705 $(".ShopListName").each(function (index) { 706 var prdcode = $(this).closest("tr").find(".ShopListPrdCode").text(); 707 708 // å å ¥å¤æ·å¼æé¤ä»¥ "ZC" éé ç 709 if (!prdcode.startsWith("ZC") && $(this).text().indexOf("åªæ ææ£") === -1) { 710 var productName = $(this).text(); // ç²åç¢åå稱 711 var productQuantity = 712 parseInt($(this).closest("tr").find(".qty").attr("qty")) || 1; // æ¨å¯ä»¥æ ¹æéè¦ä¿®æ¹éåå¼ 713 // var productValue = 714 // parseFloat($(this).closest("tr").find(".ShopListPrice").text()) || 0; 715 var productValue = parseFloat( 716 $(this).closest("tr").find(".ShopListPrice").text().replace(/,/g, '') 717 ) || 0; 718 console.log("productQuantity:", productQuantity); 719console.log("productValue:", productValue); 720 // å°ç¢åè©³ç´°ä¿¡æ¯æ·»å å°æ¸çµä¸ 721 products.push({ 722 id: prdcode, 723 name: productName, 724 quantity: productQuantity, 725 value: productValue, 726 category:null, 727 category2: null, 728 category3: null, 729 brand: null, 730 }); 731 } 732 }); 733 734 // å°å å«åå詳細信æ¯çæ¸çµæ¨éå°dataLayerä¸ 735 window.dataLayer = window.dataLayer || []; 736 window.dataLayer.push({ ecommerce: null }); 737 window.dataLayer.push({ 738 event: "GaEvent", 739 custom_label: "Purchase", 740 ecommerce: { 741 order_id: orderCode, 742 transaction_id: orderCode, 743 amount: prdTotalAmtElement, 744 value: prdTotalAmtElement, 745 currency: "TWD", 746 contents: products, 747 748 }, 749 }); 750}; 751//è£è²¨é é¢ 752let Leadinfo = (e) => { 753// console.log("æè²¨æé"); 754 if (e) { 755 e.preventDefault(); 756 } 757 var xiValue = $(".rtBuyNow.PrdBtn").not('[xi="$XmlID$"]').attr("xi"); 758// console.log("xiValue",xiValue); 759 760 var vdrCodeValue = $("#PrdInfo_" + xiValue).attr("prd"); 761 // console.log("vdrCodeValue", vdrCodeValue); 762 var resultvdrCodeValue = vdrCodeValue.replace("$VdrCode$", ""); 763// console.log("resultvdrCodeValue", resultvdrCodeValue); 764 765// console.log("Product Code: " + productCode); 766var targetElement = $(".rtBuyNow.PrdBtn[xi='" + xiValue + "']"); 767var dataNameValue = targetElement.attr("data-name"); 768// console.log("ç¢åå稱", dataNameValue); 769 770// Find the product price in NT$ 771var productPrice = $(".rtPrdPrice .PrdPriceAmt").text(); 772// console.log("Product Price in NT$: " + productPrice); 773var productPriceWithoutCommas = productPrice.replace(/,/g, ''); 774var productPriceAsInteger = parseInt(productPriceWithoutCommas, 10); 775 776// console.log("Product Price as Integer: " + productPriceAsInteger); 777// Find the product price in USD (if available) 778 779 // console.log("xiValue",xiValue); 780 // console.log("dataNameValue",dataNameValue); 781 // console.log("LeadpriceAmtValue",LeadpriceAmtValue); 782 783 window.dataLayer = window.dataLayer || []; 784 window.dataLayer.push({ ecommerce: null });
785 window.dataLayer.push({ 786 event: "GaEvent", 787 custom_label: "Lead", 788 ecommerce: { 789 id: resultvdrCodeValue, //ååç·¨è 790 name: dataNameValue, //ååå稱 791 value: productPriceAsInteger, //ååå®å¹ 792 category:null, 793 category2: null, 794 category3: null, 795 brand: null, 796 currency: CoinType, //å¹£å¥(exï¼TWD) 797 }, 798 }); 799}; 800//æ½å客æä¸å¿ 801// let customerService = (e) => { 802// console.log("客ææé"); 803// // if (e) { 804// // e.preventDefault(); 805// // } 806// // ä½¿ç¨æ£å表éå¼ä¾æåå¼èå §çæå 807 808// var cmTitleValue = $("#cmTitle").val(); 809// // var matchResult = cmTitleValue.match(/ã([^ã]+)ã/); 810// // console.log("cmTitleValue",cmTitleValue); 811// // console.log("matchResult",matchResult); 812// // å¦æææ¾å°å¹é ççµæï¼åå¾ç¬¬ä¸åæç²ç¾¤çµçå §å®¹ 813// // if (matchResult && matchResult.length > 1) { 814// // var innerText = matchResult[1]; 815// // console.log("å¼èå §çæå:", innerText); 816// // } else { 817// // console.log("æ¾ä¸å°å¼èå §çæå"); 818// // } 819 820 821 822 823// window.dataLayer = window.dataLayer || []; 824// window.dataLayer.push({ ecommerce: null }); 825// window.dataLayer.push({ 826// event: "GaEvent", 827// custom_label: "Lead", 828// ecommerce: { 829// id: 'null', //ååç·¨è 830// name: cmTitleValue, //ååå稱 831// value:'null', //ååå®å¹ 832// 'category': 'null', //åå大åé¡ï¼exï¼åæ¸å½±é³ 833// 'category2': 'null', //ååä¸åé¡ï¼exï¼ä½æç¶æ¸ 834// 'category3': 'null', //ååå°åé¡ï¼è¥æ²æï¼å¼å¸¶å ¥nullï¼ 835// 'brand': 'null',//åçå稱ï¼exï¼æ å®® or è¯åçåç 836// 'currency': 'null'//å¹£å¥(exï¼TWD) 837// }, 838// }); 839// }; 840let customerService = (e) => { 841// console.log("客ææé"); 842 843 var cmTitleValue = $("#cmTitle").val(); 844 845 // åå²å°æ¬å°ç«¯ 846 window.localStorage.setItem('cmTitle', cmTitleValue); 847 848 // å»¶é²5ç§å¾å·è¡ 849 setTimeout(() => { 850 // console.log("å·è¡ dataLayer.push"); 851 var storedTitle = window.localStorage.getItem('cmTitle'); 852 853 // æª¢æ¥æ¯å¦æ #divForm_contactUs å ç´ ä»¥åå ¶åå ç´ .ReturnDesc 854 var divForm_contactUs = $("#divForm_contactUs"); 855 var returnDesc = divForm_contactUs.find('.ReturnDesc').text().trim(); 856 // console.log("returnDesc",returnDesc); 857 if (returnDesc === "æè¬æ¨çåæï¼") { 858 if (storedTitle) { 859 window.dataLayer = window.dataLayer || []; 860 window.dataLayer.push({ ecommerce: null }); 861 window.dataLayer.push({ 862 ecommerce: null 863 }); 864 window.dataLayer.push({ 865 event: "GaEvent", 866 custom_label: "Lead", 867 ecommerce: { 868 id: 'null', 869 name: storedTitle, 870 value: 'null', 871 'category': 'null', 872 'category2': 'null', 873 'category3': 'null', 874 'brand': 'null', 875 'currency': 'null' 876 }, 877 }); 878 879 // æ¸ é¤å·²å²åçè³æ 880 window.localStorage.removeItem('cmTitle'); 881 } 882 } else { 883 console.log("æªæ¾å°ç¬¦åæ¢ä»¶çæå"); 884 } 885 }, 5000); // å»¶é²5ç§ï¼5000毫ç§ï¼ 886}; 887//Searchï¼æå°ééµåï¼ ç´æ¥è¼¸å ¥æ¿æ¬ 888// let Searchevent = (e) => { 889// console.log("æå°äºä»¶åå"); 890// // è·åæå°æ¡ä¸çæå°ééµå 891// var searchKeyword = $(".searchInput").val(); 892// console.log("searchKeyword", searchKeyword); 893 894 895// // æ£æ¥æå°ééµåæ¯å¦åå¨ 896// if (searchKeyword.trim() !== "" && searchKeyword.length >= 3) { 897// // 卿尿åå¾è§¸ç¼æ¢ä»¶ 898// console.log("æåæåæå"); 899// window.dataLayer = window.dataLayer || []; 900// window.dataLayer.push({ ecommerce: null }); 901// window.dataLayer.push({ 902// event: "GaEvent", 903// custom_label: "Search", 904// ecommerce: { 905// keyword: searchKeyword, 906// }, 907// }); 908// } 909// }; 910//Searchï¼æå°ééµåï¼å°éé é¢çæ¬ 911let Searchevent = (e) => { 912// console.log("æå°äºä»¶åå"); 913 914 915 var searchParams = new URLSearchParams(window.location.search); 916 var ssValue = searchParams.get("ss"); 917 918 919 function decodeCustom(encodedStr) { 920 return encodedStr.replace(/%u([\dA-F]{4})/gi, function (match, grp) { 921 return String.fromCharCode(parseInt(grp, 16)); 922 });
923 } 924 925 926 var searchKeyword = ssValue ? decodeCustom(ssValue) : ''; 927 928// console.log("searchKeyword:", searchKeyword); 929// console.log("æåæåæå"); 930 if (searchKeyword.trim() !== '') { 931 window.dataLayer = window.dataLayer || []; 932 window.dataLayer.push({ ecommerce: null }); 933 window.dataLayer.push({ 934 event: "GaEvent", 935 custom_label: "Search", 936 ecommerce: { 937 keyword: searchKeyword, 938 }, 939 }); 940 } 941 942}; 943//Loginï¼ç»å ¥æå¡ï¼ 944let Loginevent = (e) => { 945// console.log("ç»å ¥äºä»¶åå"); 946 947 948 var userEmail = UserData.email; 949 var userPhone = UserData.phone; 950 window.dataLayer = window.dataLayer || []; 951 window.dataLayer.push({ ecommerce: null }); 952 window.dataLayer.push({ 953 event: "GaEvent", 954 custom_label: "Login", 955 ecommerce: { 956 user_id: MemXmlID || "anonymous", //使ç¨è ç·¨è 957 email: userEmail || null, //sha 256 å å¯ä¿¡ç®± 958 phone: userPhone || null, //sha 256 å å¯è¡åé»è©± 959 }, 960 }); 961}; 962//CompleteRegistration ï¼è¨»åæåï¼ 963let CompleteRegistration = (e) => { 964// console.log("註åäºä»¶åå"); 965 966// if (userEmail === "c9500d049d3fea8011f17920625078611b7d86d652cad53a5cfb218148c02d1d") { 967// userEmail = ""; 968// } 969let emptyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; 970if (userPhone === emptyHash) { 971 userPhone = ""; 972} 973// console.log("userPhone",userPhone); 974 window.dataLayer = window.dataLayer || []; 975 window.dataLayer.push({ ecommerce: null }); 976 window.dataLayer.push({ 977 event: "GaEvent", 978 custom_label: "CompleteRegistration", 979 ecommerce: { 980 // user_id: MemXmlID || "anonymous", //使ç¨è ç·¨è 981 email: userEmail || null, //sha 256 å å¯ä¿¡ç®± 982 // phone: userPhone || '', //sha 256 å å¯è¡åé»è©± 983 }, 984 }); 985}; 986//ScrollDepthï¼ç覽深度ï¼è§¸ç¼æ¢ä»¶ï¼å¨ä»»ã§é é¢ï¼ç覽深度ç¾åä¹ 25,50,75,95 æï¼åå¥è§¸ç¼ 987// let ScrollDepthEvent = (e) => { 988// let pushCount = 0; 989// let ScrollDepthEvent = (depth) => { 990// console.log("ç覽深度"); 991// window.dataLayer = window.dataLayer || []; 992// window.dataLayer.push({ ecommerce: null }); 993// window.dataLayer.push({ 994// event: "GaEvent", 995// custom_label: "ScrollDepth", 996// ecommerce: { 997// depth: depth.toString(), 998// }, 999// }); 1000// }; 1001 1002// // æ·»å æ»¾åäºä»¶ç£è½å¨ 1003// window.addEventListener("scroll", () => { 1004// const scrollPercentage = 1005// ((document.documentElement.scrollTop + window.innerHeight) / 1006// document.documentElement.scrollHeight) * 1007// 100; 1008 1009 1010// if (scrollPercentage >= 95 && pushCount < 1) { 1011// ScrollDepthEvent(95); 1012// pushCount++; 1013// } else if (scrollPercentage >= 75 && pushCount < 1) { 1014// ScrollDepthEvent(75); 1015// pushCount++; 1016// } else if (scrollPercentage >= 50 && pushCount < 1) { 1017// ScrollDepthEvent(50); 1018// pushCount++; 1019// } else if (scrollPercentage >= 25 && pushCount < 1) { 1020// ScrollDepthEvent(25); 1021// pushCount++; 1022// } 1023// }); 1024// }; 1025let ScrollDepthEvent = () => { 1026 let depthsTriggered = { 25: false, 50: false, 75: false, 95: false }; 1027 let ScrollDepthEvent = (depth) => { 1028 // console.log("ç覽深度: " + depth); 1029 window.dataLayer = window.dataLayer || []; 1030 window.dataLayer.push({ ecommerce: null }); 1031 window.dataLayer.push({ 1032 event: "GaEvent", 1033 custom_label: "ScrollDepth", 1034 ecommerce: { 1035 depth: depth.toString(), 1036 }, 1037 }); 1038 }; 1039 1040 // æ·»å æ»¾åäºä»¶ç£è½å¨ 1041 window.addEventListener("scroll", () => { 1042 const scrollPercentage = 1043 ((document.documentElement.scrollTop + window.innerHeight) / 1044 document.documentElement.scrollHeight) * 1045 100; 1046 1047 if (scrollPercentage >= 95 && !depthsTriggered[95]) { 1048 ScrollDepthEvent(95); 1049 depthsTriggered[95] = true; 1050 } else if (scrollPercentage >= 75 && !depthsTriggered[75]) { 1051 ScrollDepthEvent(75); 1052 depthsTriggered[75] = true; 1053 } else if (scrollPercentage >= 50 && !depthsTriggered[50]) { 1054 ScrollDepthEvent(50); 1055 depthsTriggered[50] = true; 1056 } else if (scrollPercentage >= 25 && !depthsTriggered[25]) { 1057 ScrollDepthEvent(25); 1058 depthsTriggered[25] = true; 1059 } 1060 }); 1061}; 1062//é²å ¥æ¢ä»¶çæ 1063var pageActions = { 1064 prdinfoview: prdinfoview, //ç£è½æéç¢åé è§çè è³è¨ 1065 Purchaseinfo: Purchaseinfo, //çµå¸³å®æ 1066 InitiateCheckout: InitiateCheckout, //éå§çµå¸³ 1067 AddPaymentInfo: AddPaymentInfo, //填坫仿¬¾è³è¨ 1068 Loginevent: Loginevent, //ç»å ¥äºä»¶ 1069 CompleteRegistration: CompleteRegistration, //註åäºä»¶ 1070 ScrollDepth: ScrollDepthEvent, 1071 customerService:customerService,//客æä¸å¿ 1072 1073 // "Searchevent": Searchevent,//填坫仿¬¾è³è¨ 1074 // "Leadinfo": Leadinfo //è£è²¨é é¢ 1075}; 1076 1077// $(document).ready(function() { 1078// // è·åå½å页é¢å¹¶æ§è¡ç¸åºæä½ 1079// console.log("æåå·è¡å¤æ·getCurrentPageåå°æ¯"); 1080// var currentPage = getCurrentPage();
1081// if (pageActions[currentPage]) { 1082// pageActions[currentPage](); 1083// } 1084// }); 1085 1086var us_ddMonitoring_ = () => { 1087 $(document).on("click", ".faveaddcart", addToCartwish); //å¿é¡æ¸ å® 1088 // $(document).on("click", ".AddBtn", addToCart); 1089 // $(document).on("click", ".PrdBtn", addToCartprdinfo); //ç£è½æéç¢åé å å ¥è³¼ç©è» 1090 $(document).on("click", ".SaleBtn1, .SaleBtn2, .SaleBtn2", addToCartprdinfo); //ç£è½æéç¢åé å å ¥è³¼ç©è»ä¿®æ¹ç 1091 1092 $(document).on("click", ".addCartBtn", addToCartprdlist); //ç£è½ç¢åç®éé å å ¥è³¼ç©è» 1093 // $(document).on("click", ".addCartBtn", addToCartprdinterest);//ç¢åèè¶£ 1094 $(document).on("click", ".FaveBtn .cssPrdInfoFave", addToWishprdlist); //ç¢åç®éé å èè¶£ 1095 $(document).on("click", ".c5PrdInfoFave .cssPrdInfoFave", addToWishprdinfo); //ç¢åè³è¨é å èè¶£ 1096 $(document).on("click", ".stockBtn", Leadinfo);//ç¢åé è£è²¨ 1097 $(document).on("click", ".slAddCart", addTointerestCartprdinfo); //ç¢åé ä½ å¯è½æèè¶£å å ¥è³¼ç©è» 1098 $(document).on("click", ".historyAddCart", historyAddCartevent); //ç¢åé ç覽ç´éå å ¥è³¼ç©è» 1099 $(document).on("click", ".customerInfo", customerService); //客æä¸å¿ 1100// $(".searchInputBox").on('input', function() { 1101// Searchevent(); // æ¯ç¶è¼¸å ¥æ¡çå §å®¹è®åæï¼å°±èª¿ç¨ Searchevent 彿¸ 1102// }); 1103 // $(document).on("click", ".search-input", Searchevent); //æ¶å°é é¢ 1104 $(document).trigger("Searchevent"); 1105 Searchevent(); 1106 ScrollDepthEvent(); 1107 // æ ¹æç¶åé é¢åæ 調ç¨ç¸æç彿¸ 1108 var currentPage = getCurrentPage(); // æ¤èåè¨æä¸å彿¸å¯ä»¥ç²åç¶åé é¢çå稱 1109 if (pageActions[currentPage]) { 1110 pageActions[currentPage](); 1111 } 1112}; 1113//é é¢å¤æ·é輯 1114 1115// function getCurrentPage() { 1116// console.log("æåå·è¡é é¢å¤æ·"); 1117// var currentUrl = window.location.href; 1118 1119// // æª¢æ¥æ¯å¦çº prdinfoview é é¢ 1120// var prdInfoMatch = currentUrl.match( 1121// /https:\/\/www\.npmshops\.com\/mainssl\/modules\/MySpace\/PrdInfo\.php\?sn=shop&prd=(\d+)/ 1122// ); 1123 1124// if (prdInfoMatch) { 1125// console.log("æå觸ç¼prdInfoMatch"); 1126// return "prdinfoview"; 1127// } 1128 1129// // æª¢æ¥æ¯å¦çº Purchaseinfo é é¢ 1130// if (currentUrl.indexOf("ShopFinish") !== -1) { 1131// console.log("æå觸ç¼Purchaseinfo"); 1132// return "Purchaseinfo"; 1133// } 1134// // æª¢æ¥æ¯å¦çº InitiateCheckout éå§çµå¸³é é¢ 1135// if ( 1136// currentUrl.indexOf( 1137// "https://www.npmshops.com/mainssl/modules/MeOrderInfo/index.php?sn=shop" 1138// ) !== -1 1139// ) { 1140// console.log("æåè§¸ç¼ InitiateCheckout"); 1141// return "InitiateCheckout"; 1142// } 1143// // æª¢æ¥æ¯å¦çº Loginevent ç»å ¥é é¢ 1144// if ( 1145// currentUrl.includes( 1146// "https://www.npmshops.com/mainssl/modules/MeMemberInfo/index.php?sn=shop&content=LoginWelcome" 1147// ) || 1148// currentUrl.includes( 1149// "https://www.npmshops.com/mainssl/modules/MeMemberInfo/index.php?sn=shop&content=RegForm" 1150// ) || 1151// currentUrl.includes( 1152// "https://www.npmshops.com/mainssl/modules/MeOrderInfo/index.php?sn=shop&content=ShopOrder" 1153// ) 1154// ) { 1155// console.log("æåè§¸ç¼ Loginevent"); 1156// return "Loginevent"; 1157// } 1158// // æª¢æ¥æ¯å¦çº AddPaymentInfo é é¢ 1159// if ( 1160// currentUrl.indexOf( 1161// "https://www.npmshops.com/mainssl/modules/MeOrderInfo/index.php?sn=shop&content=ShopOrder" 1162// ) !== -1 1163// ) { 1164// console.log("æåè§¸ç¼ AddPaymentInfo "); 1165 1166// return ["AddPaymentInfo", "Loginevent"]; 1167// } 1168// //檢æ¥CompleteRegistration é é¢ 1169 // if ( 1170 // currentUrl.indexOf( 1171 // "https://www.npmshops.com/mainssl/modules/MeMemberInfo/index.php?sn=shop&content=CfmEmail" 1172 // ) !== -1 1173 // ) { 1174 // console.log("æåè§¸ç¼ CompleteRegistrationé é¢ "); 1175 1176 // return "CompleteRegistration"; 1177 // } 1178 1179// return ""; 1180// } 1181function getCurrentPage() { 1182 1183// console.log("æåå·è¡é é¢å¤æ·"); 1184 var currentUrl = window.location.href; 1185 var userEmail = UserData.email; 1186// console.log("使ç¨è mail",userEmail); 1187 // æª¢æ¥æ¯å¦çº prdinfoview é é¢ 1188 var prdInfoMatch = currentUrl.match( 1189 /https:\/\/www\.npmshops\.com\/mainssl\/modules\/MySpace\/PrdInfo\.php\?sn=shop&(prd|pc)=(\w+)/ 1190 ); 1191 if (prdInfoMatch) { 1192 // console.log("æå觸ç¼prdInfoMatch"); 1193 return "prdinfoview"; 1194 } 1195//檢æ¥CompleteRegistration 註åäºä»¶æ¹çºå¨äºæ¥é©mailé é¢é²è¡ 1196if (currentUrl.match(/MeMemberInfo\/index\.php\?sn=shop&content=CfmEmail(?!ChkCode)/)) { 1197// console.log("æåè§¸ç¼ CompleteRegistration"); 1198 return "CompleteRegistration"; 1199} 1200// if (currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=RegForm") && userEmail == "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855") { 1201// console.log("æåè§¸ç¼ CompleteRegistration"); 1202// return "CompleteRegistration"; 1203// } 1204 // æª¢æ¥æ¯å¦çº Purchaseinfo é é¢ 1205 if (currentUrl.indexOf("ShopFinish") !== -1) { 1206 // console.log("æå觸ç¼Purchaseinfo"); 1207 return "Purchaseinfo"; 1208 } 1209 1210 // å æª¢æ¥æ¯å¦çº AddPaymentInfo é é¢ï¼å çºå®çURLçµæ§æ´å ·é« 1211 if (currentUrl.includes("MeOrderInfo/index.php?sn=shop&content=ShopOrder")) { 1212 // console.log("æåè§¸ç¼ AddPaymentInfo"); 1213 return "AddPaymentInfo"; 1214 } 1215 1216 // æª¢æ¥æ¯å¦çº InitiateCheckout éå§çµå¸³é é¢ï¼æ¤èå·²ç¶æé¤äº AddPaymentInfo çæ æ³ 1217 if (currentUrl.includes("MeOrderInfo/index.php?sn=shop")) { 1218 // console.log("æåè§¸ç¼ InitiateCheckout"); 1219 return "InitiateCheckout"; 1220 } 1221 1222 // æª¢æ¥æ¯å¦çº Loginevent ç»å ¥é é¢ 1223 if (currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=LoginWelcome") || 1224 currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=RegForm") || 1225 currentUrl.includes("MeOrderInfo/index.php?sn=shop&content=ShopOrder") 1226 ) { 1227// console.log("æåè§¸ç¼ Loginevent"); 1228 return "Loginevent"; 1229} 1230 1231 1232 //檢æ¥customerService é é¢ 1233// if (currentUrl.includes("modules/MySpace/index.php?sn=shop&pg=ZC704")) { 1234// console.log("æåè§¸ç¼ customerService"); 1235// return "customerService"; 1236// } 1237 1238 return ""; 1239} 1240// document.addEventListener("DOMContentLoaded", function() { 1241// var currentUrl = window.location.href; 1242// if (currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=LoginWelcome") || 1243// currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=RegForm") || 1244// currentUrl.includes("MeOrderInfo/index.php?sn=shop&content=ShopOrder")) { 1245 1246// console.log("æåè§¸ç¼ Logineventç´æ¥ç£è½"); 1247// return "Loginevent"; 1248// } 1249// }); 1250document.addEventListener("DOMContentLoaded", function() { 1251 var currentUrl = window.location.href; 1252 if (currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=LoginWelcome") || 1253 currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=RegForm") || 1254 currentUrl.includes("MeOrderInfo/index.php?sn=shop&content=ShopOrder") ) { 1255 // console.log("æåè§¸ç¼ Logineventç´æ¥ç£è½"); 1256 return "Loginevent"; 1257 } 1258}); 1259
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.