PageSourceSearch

https://coffee-labo.co.jp/wp-content/cache/min/1/wp-content/themes…/assets/js/link-tracking.js?ver=1790126336

js coffee-labo.co.jp collected 2026-09-24 22:21:32 UTC 5,772 bytes, 17 lines download raw bytes

1(function(){'use strict';var LEGACY_SHOP_HOST='shop.coffee-labo.co.jp';var CHECKOUT_HOST='checkout.coffee-labo.co.jp';var SHOPIFY_STORE_ID='59722727561';function trackedAnalyticsDestination(url){if(url.hostname===CHECKOUT_HOST&&url.pathname==='/'&&url.searchParams.get('clc_chat')==='1'){return{contentId:'/chat',linkUrl:'https://'+CHECKOUT_HOST+'/?clc_chat=1'}}
2var isLegacyCheckout=url.hostname===LEGACY_SHOP_HOST&&(url.pathname==='/checkout'||url.pathname.indexOf('/checkout/')===0||url.pathname==='/checkouts'||url.pathname.indexOf('/checkouts/')===0||url.pathname==='/cart/c'||url.pathname.indexOf('/cart/c/')===0);var isLegacyAccount=url.hostname===LEGACY_SHOP_HOST&&(url.pathname==='/account'||url.pathname.indexOf('/account/')===0||url.pathname==='/customer_authentication'||url.pathname.indexOf('/customer_authentication/')===0);var shopifyAccountPath='/'+SHOPIFY_STORE_ID+'/account';if(url.hostname===CHECKOUT_HOST||isLegacyCheckout){return{contentId:'/checkout',linkUrl:url.origin+'/checkout'}}
3if(isLegacyAccount||(url.hostname==='shopify.com'&&(url.pathname===shopifyAccountPath||url.pathname.indexOf(shopifyAccountPath+'/')===0))){return{contentId:'/account',linkUrl:'https://shopify.com/'+SHOPIFY_STORE_ID+'/account'}}
4return{contentId:url.pathname||'/',linkUrl:url.href}}
5var REGIONS=[{type:'info_bar',selector:'.c-infoBar, .p-infoBar'},{type:'labocafe_banner',selector:'#labocafe-footer-banner'},{type:'fix_bottom_menu',selector:'#fix_bottom_menu, .p-fixBottomMenu'},{type:'global_menu',selector:'.l-header, #header, .c-gnav, .p-spMenu, .l-fixHeader'},{type:'footer',selector:'.l-footer, #footer'},{type:'store_cart',selector:'.clc-cart-dialog, .clc-cart-reminder'},{type:'store_chat',selector:'.clc-inbox-floating'},{type:'store_quiz',selector:'.clc-quiz-dialog'},{type:'product_card',selector:'.clc-product-card'},{type:'store_nav',selector:'.clc-shop-header, .clc-announcement, .clc-nav-panel'},{type:'store_footer',selector:'.clc-shop-footer'},{type:'store_page',selector:'.clc-storefront'},{type:'toc_reco',selector:'.toc-reco'},{type:'origin_cta',selector:'.origin-shop-cta'},{type:'widget',selector:'.widget, .c-widget, .w-beforeToc, .w-afterToc, .w-cta'},{type:'article_body',selector:'.post_content, .c-postContent, .entry-content'}];function detectRegion(anchor){for(var i=0;i<REGIONS.length;i++){var hit=anchor.closest(REGIONS[i].selector);if(hit){return{type:REGIONS[i].type,node:hit}}}
6return{type:'other',node:null}}
7function regionDetail(anchor,region){if(!region.node)return'';if(region.node.id)return region.node.id;var cls=region.node.className;if(typeof cls!=='string')return'';return cls.trim().split(/\s+/).slice(0,3).join(' ')}
8function linkText(anchor){var clone=anchor.cloneNode(!0);var junk=clone.querySelectorAll('noscript, script, style');for(var i=0;i<junk.length;i++){junk[i].parentNode.removeChild(junk[i])}
9var text=(clone.textContent||'').replace(/\s+/g,' ').trim();if(text)return text.slice(0,80);var img=anchor.querySelector('img[alt]');return img?('[img] '+img.alt).slice(0,80):''}
10function isCommercePath(pathname){return pathname==='/shop'||pathname.indexOf('/shop/')===0||pathname==='/products'||pathname.indexOf('/products/')===0||pathname==='/collections'||pathname.indexOf('/collections/')===0}
11function isTracked(url){if(url.hostname===LEGACY_SHOP_HOST)return!0;if(url.hostname===location.hostname&&(isCommercePath(url.pathname)||url.pathname.indexOf('/lp/')===0))return!0;if(url.hostname===CHECKOUT_HOST)return!0;if(url.hostname==='shopify.com'&&url.pathname.indexOf('/'+SHOPIFY_STORE_ID+'/')===0)return!0;return!1}
12var AFFILIATE_HOSTS=['moshimo.com','a8.net','accesstrade.net','afi-b.com','affitch.com','felmat.net','rentracks.jp','valuecommerce.com','rakuten.co.jp','r10.to','amazon.co.jp','amzn.to','amzn.asia','shopping.yahoo.co.jp'];function isAffiliateHost(hostname){for(var i=0;i<AFFILIATE_HOSTS.length;i++){var domain=AFFILIATE_HOSTS[i];if(hostname===domain||hostname.slice(-(domain.length+1))==='.'+domain)return!0}
13return!1}
14document.addEventListener('click',function(event){var target=event.target;if(!target||typeof target.closest!=='function')return;var anchor=target.closest('a[href]');if(!anchor)return;var url;
14try{url=new URL(anchor.href,location.href)}catch(e){return}
15var eventName=null;var contentId=null;var linkUrl=url.href;if(isTracked(url)){var destination=trackedAnalyticsDestination(url);eventName='select_content';contentId=destination.contentId;linkUrl=destination.linkUrl}else if((url.protocol==='http:'||url.protocol==='https:')&&url.hostname&&url.hostname!==location.hostname){eventName=isAffiliateHost(url.hostname)?'affiliate_click':'outbound_click';contentId=(url.hostname+url.pathname).slice(0,100)}
16if(!eventName)return;if(typeof window.gtag!=='function')return;var region=detectRegion(anchor);var text=linkText(anchor);window.gtag('event',eventName,{content_type:region.type,content_id:contentId,link_url:linkUrl,link_text:text,link_region:regionDetail(anchor,region)})},!0);document.addEventListener('wpcf7mailsent',function(event){var detail=event.detail||{};var formId=detail.contactFormId||detail.contact_form_id||'';window.dataLayer=window.dataLayer||[];if(typeof window.gtag!=='function'){window.gtag=function(){window.dataLayer.push(arguments)}}
17window.gtag('event','generate_lead',{content_type:'contact_form_7',content_id:formId?String(formId):'unknown'})});document.addEventListener('toggle',function(event){var details=event.target;if(!details||!details.classList||!details.classList.contains('toc-reco'))return;
17if(!details.open||details.getAttribute('data-reco-opened'))return;details.setAttribute('data-reco-opened','1');if(typeof window.gtag!=='function')return;window.gtag('event','toc_reco_open',{content_type:'toc_reco',content_id:location.pathname})},!0)})()

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.