Skip to content

Commit

Permalink
Remove broken JS and add a DL push when radio buttons are selected/ch…
Browse files Browse the repository at this point in the history
…anged
  • Loading branch information
jamesmking committed Jan 11, 2021
1 parent cbd5165 commit f5be788
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,20 @@

@section pageSpecificJS {
<script type="text/javascript">
$(function () {
sfa.homePage.init();
$(function () {
var pageTitle = $('h1.govuk-heading-xl').text().trim();
$('.govuk-radios').each(function () {
var dataLayerObj
var radios = $(this).find('input:radio');
radios.on('change', function () {
dataLayerObj = {
event: 'radio button selected',
page: pageTitle,
radio: this.id
}
window.dataLayer.push(dataLayerObj)
})
});
});
</script>
}

0 comments on commit f5be788

Please sign in to comment.