Skip to content

Commit

Permalink
Merge pull request #1927 from alphagov/add-custom-dimension81
Browse files Browse the repository at this point in the history
Add a custom meta tag dimension for spelling suggestions
  • Loading branch information
kr8n3r authored Nov 4, 2019
2 parents e2340da + 173d0b9 commit f789c6d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/assets/javascripts/analytics/custom-dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
'content-has-history': {dimension: 39, defaultValue: 'false'},
'publishing-application': {dimension: 89},
'stepnavs': {dimension: 96},
'relevant-result-shown': {dimension: 83}
'relevant-result-shown': {dimension: 83},
'spelling-suggestion': {dimension: 81}
};

var $metas = $('meta[name^="govuk:"]');
Expand Down
10 changes: 10 additions & 0 deletions spec/javascripts/analytics/static-analytics-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ describe("GOVUK.StaticAnalytics", function() {
expect(pageViewObject.dimension42).toEqual('name-of-test:name-of-ab-bucket');
expect(pageViewObject.dimension48).toEqual('name-of-other-test:name-of-other-ab-bucket');
});
it('sets the spelling suggestion as dimension 81', function() {
$('head').append('\
<meta name="govuk:spelling-suggestion" content="driving">\
');

analytics = new GOVUK.StaticAnalytics({universalId: 'universal-id'});
pageViewObject = getPageViewObject();

expect(pageViewObject.dimension81).toEqual('driving');
});

it('ignores A/B meta tags with invalid dimensions', function () {
$('head').append('\
Expand Down

0 comments on commit f789c6d

Please sign in to comment.