New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

govuk_frontend_toolkit

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

govuk_frontend_toolkit - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 3.2.1
- Fix: Analytics - don't run error and print plugins on load
# 3.2.0

@@ -2,0 +6,0 @@

8

docs/analytics.md

@@ -48,2 +48,6 @@ # Analytics

// Activate any event plugins eg. print intent, error tracking
// GOVUK.analyticsPlugins.error();
// GOVUK.analyticsPlugins.printIntent();
// Track initial pageview

@@ -155,6 +159,6 @@ GOVUK.analytics.trackPageview();

Pull `print-intent.js` into your project, after analytics has been initialised, to track when users are attempting to print content.
Pull `print-intent.js` into your project, and initialise it after analytics (see [Create an analytics tracker, above](#create-an-analytics-tracker)), to track when users are attempting to print content.
## Error tracking
Pull `error-tracking.js` into your project, after analytics has been initialised, to track JavaScript errors.
Pull `error-tracking.js` into your project, and initialise it after analytics (see [Create an analytics tracker, above](#create-an-analytics-tracker)), to track JavaScript errors.

@@ -5,19 +5,24 @@ // Extension to track errors using google analytics as a data store.

"use strict";
var trackJavaScriptError = function (e) {
var errorSource = e.filename + ': ' + e.lineno;
GOVUK.analytics.trackEvent('JavaScript Error', e.message, {
label: errorSource,
value: 1,
nonInteraction: true
});
};
if (window.addEventListener) {
window.addEventListener('error', trackJavaScriptError, false);
} else if (window.attachEvent) {
window.attachEvent('onerror', trackJavaScriptError);
} else {
window.onerror = trackJavaScriptError;
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {};
GOVUK.analyticsPlugins.error = function () {
var trackJavaScriptError = function (e) {
var errorSource = e.filename + ': ' + e.lineno;
GOVUK.analytics.trackEvent('JavaScript Error', e.message, {
label: errorSource,
value: 1,
nonInteraction: true
});
};
if (window.addEventListener) {
window.addEventListener('error', trackJavaScriptError, false);
} else if (window.attachEvent) {
window.attachEvent('onerror', trackJavaScriptError);
} else {
window.onerror = trackJavaScriptError;
}
}
}());
// Extension to monitor attempts to print pages.
(function () {
"use strict";
var printAttempt = (function () {
GOVUK.analytics.trackEvent('Print Intent', 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 in 3 seconds, don't log it
window.setTimeout(function () {
mqlListenerCount = 0;
// printing will be tracked again now
}, 1e3);
}
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {};
GOVUK.analyticsPlugins.printIntent = function () {
var printAttempt = (function () {
GOVUK.analytics.trackEvent('Print Intent', document.location.pathname);
});
}
// IE < 10
if (window.onafterprint) {
window.onafterprint = printAttempt;
}
// 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 in 3 seconds, don't log it
window.setTimeout(function () {
mqlListenerCount = 0;
// printing will be tracked again now
}, 1e3);
}
});
}
// IE < 10
if (window.onafterprint) {
window.onafterprint = printAttempt;
}
};
}());
{
"name": "govuk_frontend_toolkit",
"version": "3.2.0",
"version": "3.2.1",
"description": "npm package for using the GOV.UK frontend toolkit",

@@ -5,0 +5,0 @@ "repository": {

@@ -1,1 +0,1 @@

3.2.0
3.2.1

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc