-
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
Navigation AB Test #237
Navigation AB Test #237
Conversation
If we're only testing the breadcrumbs wouldnt only want to A/B that component itself? |
@NickColley we'll eventually be shuffling actual HTML around. For example, in Detailed Guide, we'll need to make space on the right-hand-side for a Related Links box. |
We will also be removing "Part of" as well, so this will be a bit more comprehensive than just breadcrumbs. |
with_locale do | ||
render content_item_template | ||
end | ||
end | ||
|
||
def should_present_b_view? | ||
(ab_testing_group == "B") && new_navigation_enabled? && content_is_tagged_to_a_taxon? |
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.
Do we have the new chrome extension ready so we can add ourselves to the B group in the A/B test on integration?
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.
Not sure. @suzannehamilton ? At the moment you can manually manipulate your own headers with a Chrome extension.
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.
That's currently on master, we'll release soon.
Yes, this is just a small change to start with to keep the PR manageable and get early feedback. |
(ab_testing_group == "B") && new_navigation_enabled? && content_is_tagged_to_a_taxon? | ||
end | ||
|
||
helper_method :should_present_b_view? |
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.
What do you think of changing this to should_present_new_content_view
? It could be hard to understand what the B version is without more context.
@@ -0,0 +1,9 @@ | |||
<%= content_for :title, "#{@content_item.page_title} - #{t("content_item.format.#{@content_item.document_type}", count: 1)}" %> |
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 the comment above, I think we could try to rename these partials to something other than a/b, so it's clearer what they render. What do you think?
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.
What do you propose? Is "New"/"Old" any better than "A"/"B"?
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.
What do you think of:
_case_study.html.erb
for the A version and:
_case_study_for_new_navigation.html.erb
for the B version?
@@ -56,4 +63,16 @@ def error_403(exception) | |||
def error_notfound | |||
render plain: 'Not found', status: :not_found | |||
end | |||
|
|||
def ab_testing_group |
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.
Could the logic for generic A/B testing be collected in a separate file?
Can we have a further separate place for the logic specific to each test?
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.
Could do, although we'd still need a method here to check if the content is tagged to a taxon. Where's the best place for such a method to live?
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 could be included as a module.
ENV['ENABLE_NEW_NAVIGATION'] == 'yes' | ||
end | ||
|
||
def content_is_tagged_to_a_taxon? |
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.
What's a taxon?
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's a new document type that defines the new navigation structure. A taxonomy is a tree of taxons. Content is tagged to these taxon nodes essentially as leaf nodes.
@@ -31,6 +29,22 @@ def content_id | |||
content_item.parsed_content["content_id"] | |||
end | |||
|
|||
def taxons |
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.
Breadcrumbs aren't included on every format.
We use a mixin pattern to include features when they're needed.
Should these methods be in a mixin and included on just the formats that need them?
This will prevent the single content_item_presenter from getting too large.
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.
Sure sounds good to me.
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.
Related: #238
@@ -0,0 +1,54 @@ | |||
<%= content_for :title, @content_item.page_title %> |
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's not clear what the differences between a.html.erb
and b.html.erb
are. Rather than two templates, could the variations be provided by picking different partials? This reduces duplication and makes the template variations clearer.
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.
eg
if should_present_b_view?
render "shared/taxon_breadcrumbs
else:
render "shared/breadcrumbs
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've not dived into it yet, but I think the HTML is going to be moving around. For example, on Detailed Guides, we need to shift the content to the left two thirds to make room for a Related Items box on the right. This would include shifting the contents and some metadata out of the way (presumably to the top of the document?). I'm not sure that just picking different partials will really cut it in this case.
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.
Or the logic could be in the partial itself, if it affects all breadcrumbs on all formats with breadcrumbs.
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.
The reason for not putting the switch in the partial itself is that I didn't want two levels of switching - it's clear coming to Detailed Guide that there's a big switch on the template. It'd be less clear if you came to a single Detailed Guide that the partials have switches buried in them, making it harder still to track down differences between views.
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.
To someone editing a detailed guide or case study, it is not clear that they need to make the change in two places.
Why does it need to be clear that there is a big switch?
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 this way you're making it explicit by saying "This is what the old content looks like", and "This is what the new content looks like."
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's not clear what the differences between a.html.erb and b.html.erb are.
I think this needs to be solved, whichever approach is taken.
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.
@fofr I'm not sure I understand what you're proposing. Surely the only way to be able to have arbitrarily different HTML views is to have two different templates (or variants)?
ebda259
to
a528d41
Compare
a528d41
to
63cbdd9
Compare
Just remembered that Rails has a "variant" feature. Would that work for us here? http://edgeguides.rubyonrails.org/4_1_release_notes.html#action-pack-variants |
@@ -75,6 +75,43 @@ class ContentItemsControllerTest < ActionController::TestCase | |||
assert_response :forbidden | |||
end | |||
|
|||
test "honours AB Testing cookie" do | |||
assert_equal "yes", ENV['ENABLE_NEW_NAVIGATION'] |
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 the testing of the AB feature be more generic, ie not be tied to this specific test?
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.
What would you propose?
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.
Mock the environment variable and mock the headers?
Then add tests specific to this AB test as well as the generic ones.
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 what good generic tests would be? The checks for AB testing aren't (and don't need to be?) generic.
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.
Maybe just your test that needs re-phrasing then, "honours AB Testing cookie" sounds generic.
f953fc1
to
df2baa4
Compare
Variants looking good! 👍 Tiny typo case_stude -> case_study |
416703e
to
0275d77
Compare
118cab3
to
c5130a5
Compare
ee4cc5f
to
3d48702
Compare
3d48702
to
70dd2b9
Compare
70dd2b9
to
df7d3c2
Compare
df7d3c2
to
736c0d2
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.
🚢
LG 👍 |
736c0d2
to
b8ebb46
Compare
b8ebb46
to
7911461
Compare
@carvil I've now bumped the versions of both |
@alecgibson could you please |
@carvil done |
🎈 |
🎉 |
Belatedly adding this Trello card for future context: https://trello.com/c/yLGE64pa/1013-changes-to-education-related-content-pages-as-part-of-the-new-navigation-in-government-frontend |
Add functionality to check for A/B Testing, and display content according to which "bucket" the user has been added to.
This WIP PR adds a helper method to the controller to check for A/B bucket (with associated tests).
As a proof-of-concept, it also updates two of the
content_item
views to show either an A or B view. Currently the only difference between the two is the display of "normal" breadcrumbs (view A) or "taxon" breadcrumbs (view B).If we continue in this style, we should add A/B views for all Content Items. Is this the best approach? If so, should we be grouping them in subfolders under
content_items
to reduce clutter? Is there any scope for commonising, or is that a waste of time, given that - if testing is successful - we'd just want to delete all the "A" views anyway in the long run.