govuk_admin_template 1.4.1 → 1.4.2

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
  SHA1:
3
- metadata.gz: 1ef36e25f58cbe51f261b5d2f1cb3490051cfb92
4
- data.tar.gz: 590744304685cc985627c467ddddd60f6d88d9ee
3
+ metadata.gz: 8877a7d38ebb9d4f4651d722563d085628f049c6
4
+ data.tar.gz: ab9b72c6a03035a3e5c640853a041b403d377d2a
5
5
  SHA512:
6
- metadata.gz: def00a1a7fc47f09339a49ac3e04a8dcbb7f3de63bd870de15d4dbd11ccebdae5133851c8411c64c48ab75f6aa856e01c3e39d606da4368ff8e48e70f771dd52
7
- data.tar.gz: ae13c7fa6d9fb50d21edfd0cc2ec00f850f3e8a88f19d12a2e8d0aa052d0c0b78669b757189d8456d0be06b0bbb690e2162364b94fb1ade9596c9696a505197d
6
+ metadata.gz: e0727631827f8e1f18ba6c534a0d8663fa50096608d4698418ab1dd3a1a15f702b484b57d0c65ece49dafd91a7703175e8f7764e94e3e69baccdad4997ab4560
7
+ data.tar.gz: b9808b52be5304be1609e76b0d24074bea38ea8ea392158856a48291f4fff74d3e6f9110f2f7451946e6a04bb71c7dbc556d71b907e72c03e1222d521f298f6c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.4.2
2
+
3
+ * Track events using universal analytics as well as classic analytics
4
+
1
5
  # 1.4.1
2
6
 
3
7
  * Prevent wrapping of environment label
@@ -71,23 +71,26 @@
71
71
  }
72
72
 
73
73
  // Google Analytics event tracking
74
- // https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
75
74
  // Label and value are optional
76
75
  GOVUKAdmin.track = function(action, label, value) {
77
76
 
78
77
  // Default category to the page an event occurs on
79
78
  var category = root.location.pathname,
80
- event;
81
79
 
82
- // _gaq is the Google Analytics tracking object we
83
- // push events to, GA asynchronously sends them on
84
- root._gaq = root._gaq || [];
80
+ // https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
81
+ eventGa = ["_trackEvent", category, action],
85
82
 
86
- event = ["_trackEvent", category, action];
83
+ // https://developers.google.com/analytics/devguides/collection/analyticsjs/events
84
+ eventAnalytics = {
85
+ hitType: 'event',
86
+ eventCategory: category,
87
+ eventAction: action
88
+ };
87
89
 
88
90
  // Label is optional
89
91
  if (typeof label === "string") {
90
- event.push(label);
92
+ eventGa.push(label);
93
+ eventAnalytics.eventLabel = label;
91
94
  }
92
95
 
93
96
  // Value is optional, but when used must be an
@@ -96,12 +99,21 @@
96
99
  if (value) {
97
100
  value = parseInt(value, 10);
98
101
  if (typeof value === "number" && !isNaN(value)) {
99
- event.push(value);
102
+ eventGa.push(value);
103
+ eventAnalytics.eventValue = value;
100
104
  }
101
105
  }
102
106
 
103
- // Useful for debugging: console.log(event);
104
- _gaq.push(event);
107
+ // _gaq is the Google Analytics tracking object we
108
+ // push events to when using the old tracking code
109
+ root._gaq = root._gaq || [];
110
+
111
+ // Useful for debugging:
112
+ // console.log(eventGa, eventAnalytics);
113
+ root._gaq.push(eventGa);
114
+ if (typeof root.ga === "function") {
115
+ root.ga('send', eventAnalytics);
116
+ }
105
117
  }
106
118
 
107
119
  })(jQuery, window);
@@ -1,3 +1,3 @@
1
1
  module GovukAdminTemplate
2
- VERSION = "1.4.1"
2
+ VERSION = "1.4.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_admin_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev