govuk_publishing_components 30.2.0 → 30.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f402d935fbe75f4dde432aab1dd5f525388d478b99a960c57cedc2b73034ea0d
|
4
|
+
data.tar.gz: e6cf9788314e58be8a0f13158e7262a31dec5ff4adece4ee2daf117ebb5252f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76b3d647997d9248dc930d224037a2d31d54aebee66879668743e7a962b85a199aff66cfc95dcb200577de4292f8dcd769ea105497df3ea71206746d798e112e
|
7
|
+
data.tar.gz: c29eaaf88f004b23c2412b3db5667533e2ed76e69b9a59679875e1dd68c2522ab15f935f6ed66ee0df3bbfd8c619aa604359afebf4e2369ff481959d4f7f535f
|
@@ -5,16 +5,16 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
5
5
|
(function (Modules) {
|
6
6
|
'use strict'
|
7
7
|
|
8
|
-
function
|
8
|
+
function Ga4EventTracker (module) {
|
9
9
|
this.module = module
|
10
10
|
this.trackingTrigger = 'data-ga4' // elements with this attribute get tracked
|
11
11
|
}
|
12
12
|
|
13
|
-
|
13
|
+
Ga4EventTracker.prototype.init = function () {
|
14
14
|
this.module.addEventListener('click', this.trackClick.bind(this), true) // useCapture must be true
|
15
15
|
}
|
16
16
|
|
17
|
-
|
17
|
+
Ga4EventTracker.prototype.trackClick = function (event) {
|
18
18
|
if (window.dataLayer) {
|
19
19
|
var target = this.findTrackingAttributes(event.target)
|
20
20
|
if (target) {
|
@@ -76,7 +76,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
76
76
|
}
|
77
77
|
}
|
78
78
|
|
79
|
-
|
79
|
+
Ga4EventTracker.prototype.findTrackingAttributes = function (clicked) {
|
80
80
|
if (clicked.hasAttribute('[' + this.trackingTrigger + ']')) {
|
81
81
|
return clicked
|
82
82
|
} else {
|
@@ -85,7 +85,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
85
85
|
}
|
86
86
|
|
87
87
|
// check if an attribute exists or contains the attribute
|
88
|
-
|
88
|
+
Ga4EventTracker.prototype.getClosestAttribute = function (clicked, attribute) {
|
89
89
|
var isAttributeOnElement = clicked.getAttribute(attribute)
|
90
90
|
var containsAttribute = clicked.querySelector('[' + attribute + ']')
|
91
91
|
|
@@ -96,5 +96,5 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
96
96
|
}
|
97
97
|
}
|
98
98
|
|
99
|
-
Modules.
|
99
|
+
Modules.Ga4EventTracker = Ga4EventTracker
|
100
100
|
})(window.GOVUK.Modules)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 30.2.
|
4
|
+
version: 30.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|