From e482f977a3fa1a46aff4d70a40314d04b113f02f Mon Sep 17 00:00:00 2001 From: Steve Laing Date: Fri, 5 Oct 2018 14:55:54 +0100 Subject: [PATCH] Send cross domain events as final tracking step We modify the options object for cross domain tracking, this alters the default behaviour. We should be performing our own event tracking first. --- app/assets/javascripts/modules/track-radio-group.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/modules/track-radio-group.js b/app/assets/javascripts/modules/track-radio-group.js index c6298ea3c..d365fae2d 100644 --- a/app/assets/javascripts/modules/track-radio-group.js +++ b/app/assets/javascripts/modules/track-radio-group.js @@ -27,10 +27,12 @@ window.GOVUK.Modules = window.GOVUK.Modules || {}; if (typeof checkedValue === 'undefined') { checkedValue = 'submitted-without-choosing' } + + GOVUK.analytics.trackEvent('Radio button chosen', checkedValue + (withHint ? '-with-hint' : ''), options) + if (typeof element.attr('data-tracking-code') !== 'undefined') { addCrossDomainTracking(element, $checkedOption, options) } - GOVUK.analytics.trackEvent('Radio button chosen', checkedValue + (withHint ? '-with-hint' : ''), options) }) }