-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Contextual comms A/B/C test #850
Conversation
1f28cb7
to
4d2afdf
Compare
4d2afdf
to
d6937e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of minor issues, mostly component style namespacing.
$light-grey: #bfc1c3; | ||
$dark-grey: #999; | ||
|
||
.native-campaign { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these styles should be prefixed with app-c-
eg. app-c-native-campaign
padding: 20px 0 0; | ||
} | ||
|
||
.native-campaign span { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use BEM naming conventions instead of applying styles to elements.
See this example: https://github.com/alphagov/government-frontend/blob/master/app/assets/stylesheets/components/_contents-list.scss#L29
end | ||
|
||
def check_your_pay_pages | ||
%w( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better in terms of performance to freeze these as constants and (optionally) return them via the methods.
$blue: #005ea5; | ||
$white: #ffffff; | ||
|
||
.blue-box-campaign { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These component styles should be prefixed with app-c-
as they are app level components.
end | ||
|
||
def set_test_response_header | ||
contextual_comms_test_variant.configure_response(response) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have a predicate around it? We should probably only set this in the test context - so maybe just on the pages listed below? Fastly will cache separate pages for each variant when this is set, so we should limit it to what is relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like:
guide_test_variant.configure_response(response) if is_tested_guide? |
@@ -25,6 +25,7 @@ | |||
<% end %> | |||
<meta name="govuk:content-id" content="<%= @content_item.content_id %>" /> | |||
<%= guide_test_variant.analytics_meta_tag.html_safe if is_tested_guide? %> | |||
<%= contextual_comms_test_variant.analytics_meta_tag.html_safe %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the other thing where we should perhaps only include if it's relevant. This is the thing that sends the analytics
d6937e3
to
c5c609e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few frontend changes - I hope this helps (and I think it may help with the IE browser issues!). Let me know if you need me to clarify anything, happy to go through in person.
(My comments probably also apply to the native-campaign component, I only reviewed the blue-box one)
@@ -0,0 +1,45 @@ | |||
$light-grey: #bfc1c3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to use colours from GOVUK Elements: http://govuk-elements.herokuapp.com/colour/
I think:
- $govuk-blue
- $grey-[1/2/3/4]
- $white
$white: #ffffff; | ||
|
||
.app-c-native-blue-box-campaign__border { | ||
display: block; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need this - div's render as blocks automatically.
.app-c-native-blue-box-campaign__border { | ||
display: block; | ||
border-top: 1px solid $light-grey; | ||
padding: 20px 0 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be simplified to padding-top: 20px
display: block; | ||
border-top: 1px solid $light-grey; | ||
padding: 20px 0 0; | ||
text-align: center; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed?
} | ||
|
||
.app-c-native-blue-box-campaign__link { | ||
display: flex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be causing your problems in IE - it doesn't have very good flexbox support. I don't think this needs flexbox as it isn't too complex.
You should just be able to use position:relative; display: block;
and delete the following lines:
display: flex;
flex-direction: column;
justify-content: space-between;
You'll then have to add the following lines to .app-c-native-blue-box-campaign__description
to make it appear at the bottom of the div:
position: absolute;
bottom: 10px;
Happy to chat through this in person!
display: block; | ||
color: $white; | ||
|
||
&:hover { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text-align: left; | ||
box-sizing: border-box; | ||
padding: 15px; | ||
font-size: 27px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest trying to use GOV.UK Elements font mixins, e.g: @include bold-24
in this case. I think this includes the line-height.
display: block; | ||
font-weight: normal; | ||
padding-top: 10px; | ||
font-size: 19px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above: I would suggest trying to use GOV.UK Elements font mixins, e.g: @include core-19
in this case. I think this includes the line-height.
@@ -0,0 +1,6 @@ | |||
<div class="app-c-native-blue-box-campaign__border"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest renaming this - although it does include border styling, this could be changed in future and the class could become misleading. It's more of a app-c-native-blue-box-campaign__container
or app-c-native-blue-box-campaign__wrapper
@@ -0,0 +1,6 @@ | |||
<div class="app-c-native-blue-box-campaign__border"> | |||
<a class="app-c-native-blue-box-campaign__link" href="<%= href %>"> | |||
<span class="app-c-native-blue-box-campaign__title"><strong><%= title %></strong></span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the right place to use <strong>
tags, a heading element may be more appropriate.
Note: we normally require components to have documentation in the relevant app component guide too. I'm not sure if you want to do this if the components are only temporary, but there's some good documentation here on our components and conventions https://github.com/alphagov/govuk_publishing_components/blob/master/docs/component_conventions.md |
c5c609e
to
875ce58
Compare
@vanitabarrett @steventux @sihugh Thanks for your reviews, your comments should be addressed now 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of small CSS refactors, otherwise looks good to me! 👍
text-align: left; | ||
box-sizing: border-box; | ||
padding: 15px; | ||
font-weight: bold; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed if you're including bold-24.
display: block; | ||
text-decoration: none; | ||
@include core-19; | ||
font-weight: bold; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want it to be bold and 19px, you can include bold-19
instead of core-19
. This means you won't need font-weight: bold
875ce58
to
bc614b3
Compare
bc614b3
to
fe66024
Compare
This is a temporary component to be used in the contextual communications A/B/C test.
This is a temporary component to be used in the contextual comms A/B/C test.
We add logic to display either a blue box campaign, a native campaign or no campaign at all depending on which test variant is set. For now, we hardcode the values being passed into the campaign components, but this will be changed in a future commit.
We update the controller logic to pass the correct title, description and link data to the campaign components when a page should display the "Get In Go Far" campaign.
We add data for the "Eating" campaign and a whitelist of pages on which the campaign is eligible to be displayed.
This ensures that pages that haven't been whitelisted to display a contextual comms campaign don't attempt to display one. We also ensure that whitelisted pages that have been assigned the 'NoCampaign' variant don't show a campaign.
This adds data to display the "Check Your Pay" campaign and whitelists the pages on which this campaign is eligible to appear.
This adds data to display the "Your Pension" campaign and whitelists the pages on which this campaign is eligible to appear.
fe66024
to
570621a
Compare
These changes have been addressed.
For https://trello.com/c/h0AKz5g2/55-overview-card-for-building-the-experiment-on-govuk
This adds an A/B/C test for the contextual comms experiment. We are testing two campaign formats (Native and Blue Box) against a control of no campaign displayed. We have four campaigns to promote and have selected a group of pages for each campaign on which the test will be conducted. After this test has concluded we intend to tear this code out.
To view the test variations in the browser, navigate to https://government-frontend-pr-850.herokuapp.com/armed-forces-pension-calculator and use the ModHeader Chrome extension to set a Request Header:
GOVUK-ABTest-ContextualComms
BlueBoxCampaign
,NativeCampaign
orNoCampaign
.Page with variation "NoCampaign"

Page with variation "NativeCampaign"

Page with variation "BlueBoxCampaign"

Component guide for this PR:
https://government-frontend-pr-850.herokuapp.com/component-guide