Skip to content

Commit

Permalink
Merge pull request #1814 from alphagov/spike-analytics
Browse files Browse the repository at this point in the history
Testing the addLinkedTrackerDomain code
  • Loading branch information
andysellick authored Aug 22, 2019
2 parents 4675bb6 + 63ffd70 commit 225d72d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/assets/javascripts/analytics/init.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
var cookieDomain = (document.domain == 'www.gov.uk') ? '.www.gov.uk' : document.domain;

var universalId = '<%= Rails.application.config.ga_universal_id %>';
var secondaryId = '<%= Rails.application.config.ga_secondary_id %>';

// Configure profiles, setup custom vars, track initial pageview
var analytics = new GOVUK.StaticAnalytics({
Expand All @@ -39,6 +40,8 @@

// Make interface public for virtual pageviews and events
GOVUK.analytics = analytics;
GOVUK.analytics.addLinkedTrackerDomain(secondaryId, 'www.gov.uk', 'gov.uk');
GOVUK.analytics.addLinkedTrackerDomain(secondaryId, 'designsystem', 'design-system.service.gov.uk');
} else {
GOVUK.analytics = dummyAnalytics
}
Expand Down
1 change: 1 addition & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ class Application < Rails::Application

# Google Analytics ID
config.ga_universal_id = ENV.fetch("GA_UNIVERSAL_ID", "UA-UNSET")
config.ga_secondary_id = ENV.fetch("GA_SECONDARY_ID", "UA-UNSET")
end
end
1 change: 1 addition & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@
config.eager_load = true

config.ga_universal_id = ENV.fetch("GA_UNIVERSAL_ID", "UA-26179049-1")
config.ga_secondary_id = ENV.fetch("GA_SECONDARY_ID", "UA-145652997-1")
end

0 comments on commit 225d72d

Please sign in to comment.