PageSourceSearch

https://www.owensoundsuntimes.com/wp-content/client-mu-plugins/pmd…/build/js/pmd-analytics.js?ver=1.0.0

js owensoundsuntimes.com collected 2026-09-24 09:23:16 UTC 9,054 bytes, 2 lines download raw bytes

1!function(){"use strict";if(void 0===window.pmdAnalyticsConfig)return void console.warn("PMD Analytics: Configuration not found.");const t=window.pmdAnalyticsConfig;if(!t.apiKey)return void console.warn("PMD Analytics: API key not configured.");const e={hasCoarsePointer:()=>window.matchMedia("(pointer: coarse)").matches,hasHover:()=>window.matchMedia("(hover: hover)").matches,mobileCheck:()=>/Mobi|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(navigator.userAgent),tabletCheck(){const t=navigator.userAgent,e=/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(t),i=("MacIntel"===navigator.platform||"Macintosh"===navigator.platform)&&navigator.maxTouchPoints>0,a=/Android/i.test(t)&&!/Mobile/i.test(t);return e||i||a},isTablet(){return!this.isMobile()&&this.tabletCheck()&&this.hasCoarsePointer()},isMobile(){return this.mobileCheck()&&this.hasCoarsePointer()},deviceType(){return this.isMobile()?"mobile":this.isTablet()?"tablet":"desktop"},browserType(){try{const t=navigator.userAgent,e=navigator.vendor;return/bot|crawler|spider|crawling/i.test(t)?"Crawler":-1!==t.indexOf("Edg")||window.StyleMedia?"Edge":window.chrome&&(window.chrome.webstore||window.chrome.runtime)||window.chrome&&/google/i.test(e)||t.match("CriOS")?"Chrome":/constructor/i.test(window.HTMLElement)||window.safari&&window.safari.pushNotification||/apple/i.test(e)&&!/crios/i.test(t)&&!/fxios/i.test(t)?"Safari":void 0!==window.InstallTrigger?"FireFox":window.opr&&window.opr.addons||window.opera||t.indexOf(" OPR/")>=0?"Opera":document.documentMode?"IE":"unknown"}catch(t){return"unknown"}},getDeviceData(){return{browser_language:navigator.language||navigator.userLanguage,device_type:this.deviceType(),browser:this.browserType()}}};window.pmdAnalytics={_ready:!1,_queue:[],trackEvent(i,a){if(!i)return void console.warn("PMD Analytics: Event name is required.");const o=e.getDeviceData()||{},n={name:i,properties:Object.assign(o,t.defaultProperties||{},a||{})};this._ready&&window.amplitude?window.amplitude.track(n.name,n.properties):this._queue.push(n)},trackPageView(e){const i=this._getPageViewExtraProperties(),a=Object.assign({},t.pageData,i,e||{});this.trackEvent("page_view",a)},trackClickEvent(){document.addEventListener("click",e=>{const c=e.target;if(!(c instanceof HTMLElement))return;const s=c.closest("a");if(!s||!s.href)return;if(s.hasAttribute("data-analytics-skip"))return;const l=s.closest(o),d=s.closest(n),u=s.closest(r),p=s.closest(a),m=s.closest(i),w=s.hasAttribute("data-analytics-event");if(!(m||p||l||d||u||w))return;const _=s.dataset.analyticsEvent||"click",g=s?.classList?.[0]?.split("__")[0]?.replace(/[-_]+/g," ")?.replace(/\b\w/g,t=>t.toUpperCase())||"Unknown",h="social_share"!==_?{click_source_type:"menu-item",anchor_text:(s.textContent||"").trim(),target_url:s.href,layout_section:g}:{share_button_location:"sharing-tools"};let y={};const f=s.dataset.analyticsProperties;if(f)try{y=JSON.parse(f)}catch(t){console.warn("PMD Analytics: Failed to parse data-analytics-properties JSON.",t)}if(!h.anchor_text&&"img"===c.tagName.toLowerCase()&&y.target_article_title&&(h.anchor_text=y.target_article_title),l)h.click_source_type="story_author_byline";else if(d)h.click_source_type="story_card_author_byline";else if(u){if(h.click_source_type="author_card",s.matches(".postmedia-author-card__image-link")){const t=s.closest(".postmedia-author-card").querySelector(".postmedia-author-card__name-link");t&&(h.anchor_text=t.textContent.trim())}}else p&&(h.click_source_type="in_page_link",h.layout_section="In Page Link");const v=this._getClickExtraProperties(c,t.pageData),b={...h,...v,...y};window.pmdAnalytics.trackEvent(_,b)})},trackScrollDepth(){const e=Date.now();let i,a=0,o=0;const n=this;let r=!1;const c=t.pageData&&t.pageData.page_type?t.pageData.page_type:"",s=t.pageData?this._getArticleAttributes("page_scroll",t.pageData):{},l=t.pageData&&t.pageData.topper_layout?t.pageData.topper_layout:null;let d=!1;function u(){const t=window.pageYOffset||document.documentElement.scrollTop,e=window.innerHeight,i=document.documentElement.scrollHeight;if(i>0){const o=Math.round((t+e)/i*100);o>a&&(a=Math.min(100,o))}const n=document.querySelector(".entry-content")||document.querySelector("article");
1if("Story"===c&&n){const i=n.getBoundingClientRect(),a=i.top+t,r=t+e;let c=0;r>a&&(c=Math.round((r-a)/i.height*100)),c=Math.max(0,Math.min(100,c)),c>o&&(o=c)}}function p(){if(r)return;r=!0,u();const t={...s,percentage_of_page_viewed:a,active_time_on_page:Math.round((Date.now()-e)/1e3)};l&&(t.topper_layout=l),o>0&&(t.percentage_of_story_viewed=o),n.trackEvent("page_scroll",t)}document.addEventListener("scroll",function(){i||(d=!0,i=setTimeout(function(){i=null,u()},200))}),document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&d&&p(),n._flushAmplitude()}),window.addEventListener("beforeunload",function(){d&&p(),n._flushAmplitude()})},trackVideoEvent(t){const e=window.pmdAnalyticsConfig?.pageData||{},i=this._getArticleAttributes("video",e);window.pmdAnalytics.trackEvent("video",{...t,...i}),window.pmdPermutiveAnalytics&&window.pmdPermutiveAnalytics.trackEvent("video",{action:t.action,user_interaction:t.user_interaction.toString()})},_flushAmplitude(){window.amplitude&&window.amplitude.flush()},_processQueue(){window.amplitude&&(this._queue.forEach(function(t){window.amplitude.track(t.name,t.properties)}),this._queue=[])},_onReady(){this._ready=!0,this._processQueue()},_getClickExtraProperties(t,e){let i={};const a=t.closest('[class*="wp-block-postmedia-"]');if(a){const t=a.closest("section.section:has(.postmedia-section-heading__label)");if(t){const e=t.querySelector(".postmedia-section-heading__label");if(e){const t=e.innerText.trim();t&&(i.widget_title=t)}}}const o=this._getArticleAttributes("click",e);return i={...i,...o},i},_getArticleAttributes(t,e){const i={};return e&&"object"==typeof e&&(Object.hasOwn(e,"article_id")&&e.article_id>0&&(i.article_id=e.article_id),Object.hasOwn(e,"article_title")&&""!==e.article_title?.trim()&&(i.article_title=e.article_title),Object.hasOwn(e,"article_authors")&&""!==e.article_authors?.trim()&&(i.article_authors=e.article_authors),Object.hasOwn(e,"article_tags")&&""!==e.article_tags?.trim()&&(i.article_tags=e.article_tags),Object.hasOwn(e,"main_category")&&""!==e.main_category?.trim()&&(i.main_category=e.main_category),Object.hasOwn(e,"publish_timestamp")&&(i.publish_timestamp=e.publish_timestamp),"page_scroll"===t&&Object.hasOwn(e,"word_count")&&(i.word_count=e.word_count)),i},_getPageViewExtraProperties(){const t={},e=document.referrer;let i=sessionStorage.getItem("originalReferrer");i||(sessionStorage.setItem("originalReferrer",e),i=e),(!e||0!==e.indexOf(location.protocol+"//"+location.host))&&i&&(t.referrer=i);const a=new URLSearchParams(location.search);if(a.has("utm_source")){const e=a.get("utm_source")||"";/^[a-z0-9_\-]+$/i.test(e)&&(t.referral_details=e)}const o=location.hostname;return/^[a-z0-9.-]+$/i.test(o)&&(t.domain=o),t}};const i=['nav[aria-label="Primary Navigation"]','nav[aria-label="Secondary Navigation"]','nav[aria-label="Footer Menu"]',".navigation-drawer"].join(","),a=".entry-content, article",o=".author-meta",n=".pm-author-byline",r=".postmedia-author-card";function c(){const e=document.createElement("script");e.src=t.sdkUrl,e.async=!0,e.onload=function(){s()},e.onerror=function(){console.error("PMD Analytics: Failed to load Amplitude SDK.")},document.head.appendChild(e)}function s(){void 0!==window.amplitude?(window.pmdAmplitudeSDKLoaded||window.amplitude.init(t.apiKey,t.config||{}),function(){let e=0;!function i(){e++;let a=null;try{"function"==typeof window.amplitude.getDeviceId&&(a=window.amplitude.getDeviceId())}catch(t){}if(!a)try{const e=localStorage.getItem("AMP_"+t.apiKey);if(e){const t=JSON.parse(e);t&&t.deviceId&&(a=t.deviceId)}}catch(t){}if(a){try{localStorage.setItem("pmd_amplitude_device_id",a)}catch(t){return}window.pmdAmplitudeDeviceId=a}else e<50&&setTimeout(i,100)}()}(),window.pmdAnalytics._onReady(),window.pmdAnalytics.trackPageView(),window.pmdAnalytics.trackClickEvent(),window.pmdAnalytics.trackScrollDepth(),window.pmdAds=window.pmdAds||{},window.pmdAds.onAdEvent=function(t,e,i){if("complete"!==t)return;if(i&&!e.video_id&&void 0!==window.jwplayer){const t=window.jwplayer(i),a=t.getPlaylistItem();a&&(this._currentPlaylistIndex=t.getPlaylistIndex?t.getPlaylistIndex():0,e.videoId=a.mediaid,e.videoTitle=a.title)}
1const a=!e.autoplay||!e.adMuted;window.pmdAnalytics.trackVideoEvent({action:"Ad View Completed",video_id:e.videoId||"",video_name:e.videoTitle||"",user_interaction:a,video_autoplay:!!e.autoplay,video_location:e.autoplay?"featured":"inline",video_volume_enabled:!e.adMuted,video_platform:"JW Player"})}):console.error("PMD Analytics: Amplitude SDK not available.")}window.pmdAmplitudeSDKLoading?window.pmdAmplitudeSDKLoaded?s():window._pmdAmplitudeOnReady=s:"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c):c()}();
2//# sourceMappingURL=pmd-analytics.js.map

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.