govuk_frontend_toolkit 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/CHANGELOG.md +4 -0
- data/app/assets/VERSION.txt +1 -1
- data/app/assets/docs/analytics.md +6 -2
- data/app/assets/javascripts/govuk/analytics/error-tracking.js +19 -14
- data/app/assets/javascripts/govuk/analytics/print-intent.js +28 -23
- data/app/assets/stylesheets/_css3.scss +6 -2
- metadata +3 -3
data/app/assets/CHANGELOG.md
CHANGED
data/app/assets/VERSION.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.2.
|
1
|
+
3.2.1
|
@@ -45,6 +45,10 @@ The minimum you need to use the analytics function is:
|
|
45
45
|
// Set custom dimensions before tracking pageviews
|
46
46
|
// GOVUK.analytics.setDimension(…)
|
47
47
|
|
48
|
+
// Activate any event plugins eg. print intent, error tracking
|
49
|
+
// GOVUK.analyticsPlugins.error();
|
50
|
+
// GOVUK.analyticsPlugins.printIntent();
|
51
|
+
|
48
52
|
// Track initial pageview
|
49
53
|
GOVUK.analytics.trackPageview();
|
50
54
|
})();
|
@@ -151,8 +155,8 @@ function setPixelDensityDimension(pixelDensity) {
|
|
151
155
|
|
152
156
|
## Print tracking
|
153
157
|
|
154
|
-
Pull `print-intent.js` into your project, after analytics
|
158
|
+
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.
|
155
159
|
|
156
160
|
## Error tracking
|
157
161
|
|
158
|
-
Pull `error-tracking.js` into your project, after analytics
|
162
|
+
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.
|
@@ -2,21 +2,26 @@
|
|
2
2
|
(function() {
|
3
3
|
|
4
4
|
"use strict";
|
5
|
-
var trackJavaScriptError = function (e) {
|
6
|
-
var errorSource = e.filename + ': ' + e.lineno;
|
7
|
-
GOVUK.analytics.trackEvent('JavaScript Error', e.message, {
|
8
|
-
label: errorSource,
|
9
|
-
value: 1,
|
10
|
-
nonInteraction: true
|
11
|
-
});
|
12
|
-
};
|
13
5
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
6
|
+
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {};
|
7
|
+
|
8
|
+
GOVUK.analyticsPlugins.error = function () {
|
9
|
+
var trackJavaScriptError = function (e) {
|
10
|
+
var errorSource = e.filename + ': ' + e.lineno;
|
11
|
+
GOVUK.analytics.trackEvent('JavaScript Error', e.message, {
|
12
|
+
label: errorSource,
|
13
|
+
value: 1,
|
14
|
+
nonInteraction: true
|
15
|
+
});
|
16
|
+
};
|
17
|
+
|
18
|
+
if (window.addEventListener) {
|
19
|
+
window.addEventListener('error', trackJavaScriptError, false);
|
20
|
+
} else if (window.attachEvent) {
|
21
|
+
window.attachEvent('onerror', trackJavaScriptError);
|
22
|
+
} else {
|
23
|
+
window.onerror = trackJavaScriptError;
|
24
|
+
}
|
20
25
|
}
|
21
26
|
|
22
27
|
}());
|
@@ -1,31 +1,36 @@
|
|
1
1
|
// Extension to monitor attempts to print pages.
|
2
2
|
(function () {
|
3
|
-
|
4
3
|
"use strict";
|
5
|
-
var printAttempt = (function () {
|
6
|
-
GOVUK.analytics.trackEvent('Print Intent', document.location.pathname);
|
7
|
-
});
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
if (!mql.matches && mqlListenerCount === 0) {
|
15
|
-
printAttempt();
|
16
|
-
mqlListenerCount++;
|
17
|
-
// If we try and print again in 3 seconds, don't log it
|
18
|
-
window.setTimeout(function () {
|
19
|
-
mqlListenerCount = 0;
|
20
|
-
// printing will be tracked again now
|
21
|
-
}, 1e3);
|
22
|
-
}
|
5
|
+
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {};
|
6
|
+
|
7
|
+
GOVUK.analyticsPlugins.printIntent = function () {
|
8
|
+
var printAttempt = (function () {
|
9
|
+
GOVUK.analytics.trackEvent('Print Intent', document.location.pathname);
|
23
10
|
});
|
24
|
-
}
|
25
11
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
12
|
+
// Most browsers
|
13
|
+
if (window.matchMedia) {
|
14
|
+
var mediaQueryList = window.matchMedia('print'),
|
15
|
+
mqlListenerCount = 0;
|
16
|
+
mediaQueryList.addListener(function (mql) {
|
17
|
+
if (!mql.matches && mqlListenerCount === 0) {
|
18
|
+
printAttempt();
|
19
|
+
mqlListenerCount++;
|
20
|
+
// If we try and print again in 3 seconds, don't log it
|
21
|
+
window.setTimeout(function () {
|
22
|
+
mqlListenerCount = 0;
|
23
|
+
// printing will be tracked again now
|
24
|
+
}, 1e3);
|
25
|
+
}
|
26
|
+
});
|
27
|
+
}
|
28
|
+
|
29
|
+
// IE < 10
|
30
|
+
if (window.onafterprint) {
|
31
|
+
window.onafterprint = printAttempt;
|
32
|
+
}
|
33
|
+
|
34
|
+
};
|
30
35
|
|
31
36
|
}());
|
@@ -20,13 +20,17 @@
|
|
20
20
|
box-shadow: $shadow;
|
21
21
|
}
|
22
22
|
|
23
|
-
@mixin scale($x, $y) {
|
23
|
+
@mixin scale($x, $y, $transform-origin: 50% 50% 0) {
|
24
24
|
// $x and $y should be numeric values without units
|
25
25
|
-webkit-transform: scale($x, $y); // Still in use now, started at: Chrome 4.0, Safari 3.1, Mobile Safari 3.2, Android 2.1
|
26
26
|
-moz-transform: scale($x, $y); // Firefox 3.5 to 15.0
|
27
27
|
-ms-transform: scale($x, $y); // IE9 only
|
28
|
-
-o-transform: scale($x, $y); // Opera 10.5 to 12.0
|
29
28
|
transform: scale($x, $y);
|
29
|
+
|
30
|
+
-webkit-transform-origin: $transform-origin; // Chrome, Safari 3.1
|
31
|
+
-moz-transform-origin: $transform-origin; // Firefox 10 to 15.0
|
32
|
+
-ms-transform-origin: $transform-origin; // IE9
|
33
|
+
transform-origin: $transform-origin;
|
30
34
|
}
|
31
35
|
|
32
36
|
@mixin translate($x, $y) {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_frontend_toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -288,7 +288,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
288
288
|
version: '0'
|
289
289
|
segments:
|
290
290
|
- 0
|
291
|
-
hash:
|
291
|
+
hash: 3608935864278764479
|
292
292
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
293
293
|
none: false
|
294
294
|
requirements:
|
@@ -297,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
297
297
|
version: '0'
|
298
298
|
segments:
|
299
299
|
- 0
|
300
|
-
hash:
|
300
|
+
hash: 3608935864278764479
|
301
301
|
requirements: []
|
302
302
|
rubyforge_project:
|
303
303
|
rubygems_version: 1.8.23
|