Sha256: 137c6313f61d8e8f28eeb399743fd2041c6d99d0ac85fadcf616436cfd8cc04e
Contents?: true
Size: 1.01 KB
Versions: 28
Compression:
Stored size: 1.01 KB
Contents
// Extension to monitor attempts to print pages. (function () { "use strict"; GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {}; GOVUK.analyticsPlugins.printIntent = function () { var printAttempt = (function () { GOVUK.analytics.trackEvent('Print Intent', document.location.pathname); GOVUK.analytics.trackPageview('/print' + document.location.pathname); }); // Most browsers if (window.matchMedia) { var mediaQueryList = window.matchMedia('print'), mqlListenerCount = 0; mediaQueryList.addListener(function (mql) { if (!mql.matches && mqlListenerCount === 0) { printAttempt(); mqlListenerCount++; // If we try and print again within 3 seconds, don't log it window.setTimeout(function () { mqlListenerCount = 0; // printing will be tracked again now }, 3000); } }); } // IE < 10 if (window.onafterprint) { window.onafterprint = printAttempt; } }; }());
Version data entries
28 entries across 28 versions & 1 rubygems