Skip to content

Commit

Permalink
Restore check for window.ga
Browse files Browse the repository at this point in the history
- this was unintentionally removed in a recent change
  • Loading branch information
andysellick committed Nov 11, 2021
1 parent fcb1e3b commit 2494af0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/assets/javascripts/modules/set-ga-client-id-on-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};

SetGaClientIdOnForm.prototype.init = function () {
var form = this.$module
window.ga(function (tracker) {
var clientId = tracker.get('clientId')
var action = form.getAttribute('action')
form.setAttribute('action', action + '?_ga=' + clientId)
})

if (window.ga) {
window.ga(function (tracker) {
var clientId = tracker.get('clientId')
var action = form.getAttribute('action')
form.setAttribute('action', action + '?_ga=' + clientId)
})
}
}

Modules.SetGaClientIdOnForm = SetGaClientIdOnForm
Expand Down

0 comments on commit 2494af0

Please sign in to comment.