Skip to content
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

Merged
merged 11 commits into from
Mar 29, 2018
Merged

Conversation

emmabeynon
Copy link
Contributor

@emmabeynon emmabeynon commented Mar 27, 2018

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:

  • Name: GOVUK-ABTest-ContextualComms
  • Value: BlueBoxCampaign, NativeCampaign or NoCampaign.

Page with variation "NoCampaign"
nocampaign

Page with variation "NativeCampaign"
nativecampaign

Page with variation "BlueBoxCampaign"
blueboxcampaign


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

@tijmenb tijmenb temporarily deployed to government-frontend-pr-850 March 27, 2018 09:47 Inactive
@emmabeynon emmabeynon force-pushed the contextual-comms-abc-test branch from 1f28cb7 to 4d2afdf Compare March 27, 2018 10:02
@boffbowsh boffbowsh temporarily deployed to government-frontend-pr-850 March 27, 2018 10:02 Inactive
@emmabeynon emmabeynon force-pushed the contextual-comms-abc-test branch from 4d2afdf to d6937e3 Compare March 27, 2018 10:14
@boffbowsh boffbowsh temporarily deployed to government-frontend-pr-850 March 27, 2018 10:16 Inactive
Copy link
Contributor

@steventux steventux left a 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 {
Copy link
Contributor

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 {
Copy link
Contributor

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(
Copy link
Contributor

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 {
Copy link
Contributor

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)
Copy link
Contributor

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.

Copy link
Contributor

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 %>
Copy link
Contributor

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

@emmabeynon emmabeynon force-pushed the contextual-comms-abc-test branch from d6937e3 to c5c609e Compare March 27, 2018 15:19
@boffbowsh boffbowsh temporarily deployed to government-frontend-pr-850 March 27, 2018 15:19 Inactive
Copy link
Contributor

@vanitabarrett vanitabarrett left a 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;
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an FYI - the focus state when you click on the box doesn't meet accessible color contrast guidelines. You may want to consider changing the text to black on focus.

screen shot 2018-03-27 at 17 01 10

text-align: left;
box-sizing: border-box;
padding: 15px;
font-size: 27px;
Copy link
Contributor

@vanitabarrett vanitabarrett Mar 27, 2018

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;
Copy link
Contributor

@vanitabarrett vanitabarrett Mar 27, 2018

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">
Copy link
Contributor

@vanitabarrett vanitabarrett Mar 27, 2018

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>
Copy link
Contributor

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.

@vanitabarrett
Copy link
Contributor

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

@emmabeynon emmabeynon force-pushed the contextual-comms-abc-test branch from c5c609e to 875ce58 Compare March 28, 2018 10:01
@boffbowsh boffbowsh temporarily deployed to government-frontend-pr-850 March 28, 2018 10:02 Inactive
@emmabeynon
Copy link
Contributor Author

@vanitabarrett @steventux @sihugh Thanks for your reviews, your comments should be addressed now 👍

Copy link
Contributor

@vanitabarrett vanitabarrett left a 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;
Copy link
Contributor

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;
Copy link
Contributor

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

@emmabeynon emmabeynon force-pushed the contextual-comms-abc-test branch from 875ce58 to bc614b3 Compare March 28, 2018 10:35
@boffbowsh boffbowsh temporarily deployed to government-frontend-pr-850 March 28, 2018 10:35 Inactive
@emmabeynon emmabeynon force-pushed the contextual-comms-abc-test branch from bc614b3 to fe66024 Compare March 28, 2018 14:39
@boffbowsh boffbowsh temporarily deployed to government-frontend-pr-850 March 28, 2018 14:39 Inactive
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.
@emmabeynon emmabeynon force-pushed the contextual-comms-abc-test branch from fe66024 to 570621a Compare March 28, 2018 15:32
@emmabeynon emmabeynon dismissed steventux’s stale review March 29, 2018 09:01

These changes have been addressed.

@emmabeynon emmabeynon merged commit 0831526 into master Mar 29, 2018
@emmabeynon emmabeynon deleted the contextual-comms-abc-test branch March 29, 2018 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants