diff --git a/app/assets/javascripts/analytics/init.js.erb b/app/assets/javascripts/analytics/init.js.erb index 9e5ee701f..985d02477 100644 --- a/app/assets/javascripts/analytics/init.js.erb +++ b/app/assets/javascripts/analytics/init.js.erb @@ -1,4 +1,4 @@ -(function() { +(function(global) { "use strict"; // Load Google Analytics libraries @@ -14,9 +14,16 @@ var analytics = new GOVUK.StaticAnalytics({ universalId: universalId, cookieDomain: cookieDomain, + allowLinker: true, govukTrackerGifUrl: '<%= asset_path "/static/a.gif" %>', }); // Make interface public for virtual pageviews and events GOVUK.analytics = analytics; -})(); + + if (global.ga) { + var ga = global.ga; + ga('require', 'linker'); + ga('linker:autoLink', ['planforbritain.gov.uk']); + } +})(window);