govuk_frontend_toolkit
Advanced tools
Comparing version 3.5.0 to 3.5.1
@@ -0,4 +1,11 @@ | ||
#3.5.1 | ||
- Changes Analytics API library to accept one, both or neither of the | ||
analytics tracking codes. This means we can start removing classic | ||
tracking codes from apps. | ||
#3.5.0 | ||
- Adds cross domain tracking to Analytics API library: https://github.com/alphagov/govuk_frontend_toolkit/pull/185 | ||
- Adds sass variables for discovery and live phases | ||
@@ -5,0 +12,0 @@ #3.4.2 |
@@ -21,2 +21,3 @@ # Analytics | ||
2. Copy the following `init` script into your own project and replace the dummy IDs with your own (they begin with `UA-`). | ||
* Tracker.js accepts one or both analytics tracking code, so if you are only using one type of analytics (Classic or Universal) omit the one you don't need from the instantiation of GOVUK.Tracker. (NB you will still need to include both google-analytics-classic-tracker.js and google-analytics-universal-tracker.js in your project as they are currently loaded ahead of instantiation.) | ||
* This initialisation can occur immediately as this API has no dependencies. | ||
@@ -23,0 +24,0 @@ * Load and create the analytics tracker at the earliest opportunity so that: |
@@ -124,5 +124,8 @@ (function() { | ||
this.setCustomVariable(index, value, name, scope); | ||
} | ||
}; | ||
// Match tracker and universal API | ||
GoogleAnalyticsClassicTracker.prototype.addLinkedTrackerDomain = function() {}; | ||
GOVUK.GoogleAnalyticsClassicTracker = GoogleAnalyticsClassicTracker; | ||
})(); |
@@ -9,4 +9,9 @@ (function() { | ||
var Tracker = function(config) { | ||
this.universal = new GOVUK.GoogleAnalyticsUniversalTracker(config.universalId, config.cookieDomain); | ||
this.classic = new GOVUK.GoogleAnalyticsClassicTracker(config.classicId, config.cookieDomain); | ||
this.trackers = []; | ||
if (typeof config.universalId != 'undefined') { | ||
this.trackers.push(new GOVUK.GoogleAnalyticsUniversalTracker(config.universalId, config.cookieDomain)); | ||
} | ||
if (typeof config.classicId != 'undefined') { | ||
this.trackers.push(new GOVUK.GoogleAnalyticsClassicTracker(config.classicId, config.cookieDomain)); | ||
} | ||
}; | ||
@@ -20,4 +25,5 @@ | ||
Tracker.prototype.trackPageview = function(path, title) { | ||
this.classic.trackPageview(path); | ||
this.universal.trackPageview(path, title); | ||
for (var i=0; i < this.trackers.length; i++) { | ||
this.trackers[i].trackPageview(path, title); | ||
} | ||
}; | ||
@@ -32,4 +38,5 @@ | ||
Tracker.prototype.trackEvent = function(category, action, options) { | ||
this.classic.trackEvent(category, action, options); | ||
this.universal.trackEvent(category, action, options); | ||
for (var i=0; i < this.trackers.length; i++) { | ||
this.trackers[i].trackEvent(category, action, options); | ||
} | ||
}; | ||
@@ -39,4 +46,5 @@ | ||
var target = location.pathname; | ||
this.classic.trackSocial(network, 'share', target); | ||
this.universal.trackSocial(network, 'share', target); | ||
for (var i=0; i < this.trackers.length; i++) { | ||
this.trackers[i].trackSocial(network, 'share', target); | ||
} | ||
}; | ||
@@ -49,4 +57,5 @@ | ||
Tracker.prototype.setDimension = function(index, value, name, scope) { | ||
this.universal.setDimension(index, value); | ||
this.classic.setCustomVariable(index, value, name, scope); | ||
for (var i=0; i < this.trackers.length; i++) { | ||
this.trackers[i].setDimension(index, value, name, scope); | ||
} | ||
}; | ||
@@ -58,3 +67,5 @@ | ||
Tracker.prototype.addLinkedTrackerDomain = function(trackerId, name, domain) { | ||
this.universal.addLinkedTrackerDomain(trackerId, name, domain); | ||
for (var i=0; i < this.trackers.length; i++) { | ||
this.trackers[i].addLinkedTrackerDomain(trackerId, name, domain); | ||
} | ||
}; | ||
@@ -61,0 +72,0 @@ |
{ | ||
"name": "govuk_frontend_toolkit", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"description": "npm package for using the GOV.UK frontend toolkit", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -1,1 +0,1 @@ | ||
3.5.0 | ||
3.5.1 |
473953
902