1var registerSuccessBz = $("#registerSuccessBz").val(); 2if(registerSuccessBz){ 3 if(typeof gtag != 'undefined'){ 4 gtag("event", "sign_up", { 5 method: "Register" 6 }); 7 8 //facebook ads 9 /*fbq('track', 'CompleteRegistration');*/ 10 } 11} 12 13function googleAddToCart(currentSku){ 14 //semå å ¥è´ç©è½¦è½¬å 15 if(null != googleGA4 && googleGA4.cartId){ 16 gtag('event', 'conversion', { 17 'send_to': googleGA4.cartId, 18 'value': currentSku.skuPricePromotion, 19 'currency': currencyValue 20 }); 21 } 22 if(typeof gtag != 'undefined'){ 23 //google ads 24 if(currencyValue == 'BRL'){ 25 window.dataLayer = window.dataLayer || []; 26 window.dataLayer.push({ ecommerce: null }); 27 window.dataLayer.push({ 28 event: "add_to_cart", 29 ecommerce: { 30 currency: currencyValue, 31 value: currentSku.skuPricePromotion, 32 items: [ 33 { 34 "id": currentSku.skuCode, 35 "name": currentSku.skuCode, 36 "brand": "DXRacer", 37 "quantity": 1, 38 "price": currentSku.skuPricePromotion 39 } 40 ] 41 } 42 }); 43 }else{ 44 gtag('event', 'add_to_cart', { 45 value: currentSku.skuPricePromotion, 46 currency: currencyValue, 47 "items": [ 48 { 49 "id": currentSku.skuCode, 50 "name": currentSku.skuCode, 51 "brand": "DXRacer", 52 "quantity": 1, 53 "price": currentSku.skuPricePromotion 54 } 55 ] 56 }); 57 } 58 59 //facebook ads 60 /*fbq('track', 'AddToCart', { 61 contents: [ 62 { id: currentSku.skuCode, quantity: 1 } 63 ], 64 content_type: 'product', 65 value: currentSku.skuPricePromotion, 66 currency: currencyValue, 67 })*/ 68 } 69} 70 71function googleSelectSku(){ 72 if(typeof gtag != 'undefined'){ 73 gtag('event', 'select_content', { 74 "content_type": "product", 75 "items": [ 76 { 77 "id": currentSku.skuCode, 78 "name": currentSku.skuCode, 79 "brand": "DXRacer", 80 "quantity": 1, 81 "price": currentSku.skuPricePromotion 82 } 83 ] 84 }); 85 } 86} 87 88function googleViewSku(){ 89 if(currencyValue == 'BRL'){ 90 window.dataLayer.push({ 91 ecommerce: null 92 }); 93 window.dataLayer.push({ 94 event: "view_item", 95 ecommerce: { 96 currency: currencyValue, 97 value: currentSku.skuPricePromotion, 98 items: [{ 99 item_id: currentSku.skuCode, 100 item_name: currentSku.skuTitle, 101 item_brand: "DXRacer", 102 item_category: currentSku.seriesName, 103 item_variant: currentSku.fullSizeName, 104 price: currentSku.skuPricePromotion, 105 quantity: 1, 106 affiliation: "DXRacer" 107 }] 108 } 109 }); 110 }else{ 111 if(typeof gtag != 'undefined'){ 112 gtag('event', 'view_item', { 113 "items": [ 114 { 115 "id": currentSku.skuCode, 116 "name": currentSku.skuCode, 117 "brand": "Dxracer", 118 "quantity": 1, 119 "price": currentSku.skuPricePromotion 120 } 121 ] 122 }); 123 //facebook ads 124 /*fbq('track', 'ViewContent', { 125 content_ids: [currentSku.skuCode], 126 content_type: 'product', 127 value: currentSku.skuPricePromotion, 128 currency: currencyValue, 129 content_name: currentSku.skuCode 130 })*/ 131 } 132 } 133} 134 135function googleViewSkuList(){ 136 if(collection){ 137 let children = collection.children 138 if(children && children.length > 0){ 139 let items = [] 140 for(let seriesIndex in children){ 141 let products = children[seriesIndex].products 142 if(products && products.length > 0){ 143 for(let productIndex in products){ 144 let skuList = products[productIndex].skuList 145 if(skuList && skuList.length > 0){ 146 let sku = skuList[0] 147 let item = { 148 item_id: sku.skuCode, 149 item_name: sku.skuTitle, 150 item_brand: "DXRacer", 151 item_category: sku.seriesName, 152 price: sku.skuPricePromotion, 153 index: productIndex, 154 item_list_id: collection.label, 155 item_list_name: collection.label 156 } 157 items.push(item) 158 } 159 } 160 } 161 } 162 163 if(items && items.length > 0){ 164 window.dataLayer.push({ 165 ecommerce: null 166 });
167 window.dataLayer.push({ 168 event: "view_item_list", 169 ecommerce: { 170 item_list_id: collection.label, 171 item_list_name: collection.label, 172 items: items 173 } 174 }); 175 } 176 } 177 } 178} 179 180function googleViewAllSkuList(){ 181 if(collection && collection.length > 0){ 182 let items = [] 183 for(let seriesIndex in collection){ 184 let skuList = collection[seriesIndex].skuList 185 if(skuList && skuList.length > 0){ 186 let sku = skuList[0] 187 let item = { 188 item_id: sku.skuCode, 189 item_name: sku.skuTitle, 190 item_brand: "DXRacer", 191 item_category: sku.seriesName, 192 price: sku.skuPricePromotion, 193 index: seriesIndex, 194 item_list_id: collection[0].rootSeriesName, 195 item_list_name: collection[0].rootSeriesName 196 } 197 items.push(item) 198 } 199 } 200 201 if(items && items.length > 0){ 202 window.dataLayer.push({ 203 ecommerce: null 204 }); 205 window.dataLayer.push({ 206 event: "view_item_list", 207 ecommerce: { 208 item_list_id: collection[0].rootSeriesName, 209 item_list_name: collection[0].rootSeriesName, 210 items: items 211 } 212 }); 213 } 214 } 215} 216 217function googleSearchAllSkuList(){ 218 let items = [] 219 let skuCodeArr = [] 220 if(collection && collection.length > 0){ 221 for(let seriesIndex in collection){ 222 let skuList = collection[seriesIndex].skuList 223 if(skuList && skuList.length > 0){ 224 let sku = skuList[0] 225 let item = { 226 item_id: sku.skuCode, 227 item_name: sku.skuTitle, 228 item_brand: "DXRacer", 229 item_category: sku.seriesName, 230 price: sku.skuPricePromotion, 231 index: seriesIndex, 232 item_list_id: collection[0].rootSeriesName, 233 item_list_name: collection[0].rootSeriesName 234 } 235 items.push(item) 236 } 237 } 238 } 239 240 if(items && items.length > 0){ 241 skuCodeArr = items.map(i=>i.item_id) 242 } 243 244 window.dataLayer.push({ 245 ecommerce: null 246 }); 247 window.dataLayer.push({ 248 event: "search", 249 search_term: q, 250 ecommerce: { 251 items: items, 252 ids_geral: skuCodeArr 253 } 254 }); 255} 256 257function googlePurchaseInfo(currentOrder){ 258 try { 259 let paymentType = 'mercadopago'; 260 if(currentOrder.payType == 'mercadopago'){ 261 paymentType = 'Credit Card'; 262 }else if(currentOrder.payType == 'mercadopago-pix'){ 263 paymentType = 'PIX'; 264 }else if(currentOrder.payType == 'mercadopago-boleto'){ 265 paymentType = 'Boleto'; 266 } 267 let items = new Array(); 268 let skuList = currentOrder.items 269 const shippingAddrJson = JSON.parse(currentOrder.shippingAddrJson) 270 if(skuList && skuList.length > 0){ 271 272 273 for(let i=0;i<skuList.length;i++){ 274 let item = 275 { 276 "item_id": skuList[i].skuCode, 277 "item_name": skuList[i].skuTitle, 278 "item_brand": "Dxracer", 279 "quantity": skuList[i].quantity, 280 "price": skuList[i].paymentPrice, 281 "discount": skuList[i].discountFee, 282 "coupon": currentOrder.couponCode, 283 "affiliation": "DXRacer" 284 } 285 items[i] = item; 286 } 287 288 window.dataLayer.push({ 289 ecommerce: null 290 }); 291 window.dataLayer.push({ 292 event: "purchase", 293 ecommerce: { 294 transaction_id: currentOrder.orderNo, 295 // unique order ID 296 value: currentOrder.orderFee, 297 // sum of price*quantity from items 298 tax: currentOrder.tax, 299 // tax, if applicable (usually 0) 300 shipping: currentOrder.shipping, 301 // shipping cost 302 currency: currentOrder.saleCurrency, 303 coupon: currentOrder.couponCode, 304 // coupon applied, if any 305 payment_type: paymentType, 306 // same standard as add_payment_info 307 items: items 308 }, 309 user_data: { 310 email: shippingAddrJson.email, 311 phone: shippingAddrJson.phone, 312 first_name: shippingAddrJson.firstName, 313 last_name: shippingAddrJson.lastName, 314 cep: shippingAddrJson.zip, 315 city: shippingAddrJson.city, 316 state: shippingAddrJson.state, 317 country: "br" 318 } 319 }); 320 } 321 } catch (error) { 322 console.log(error.message); 323 } 324}
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.