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 tracking for our new taxonomy navigation #1054

Merged
merged 1 commit into from
Aug 15, 2018

Conversation

vanitabarrett
Copy link
Contributor

@vanitabarrett vanitabarrett commented Aug 15, 2018

Trello: https://trello.com/c/CALq4uG8/132-add-tracking-for-ab-test

Adds Google Analytics tracking to Topic, Collection, related taxon and step by step links.

Banner with taxon and step by step links:
screen shot 2018-08-15 at 16 01 16

Topic & Collection links:
screen shot 2018-08-15 at 16 01 21

How to test

You will need to have an extension like ModHeader installed in your browser to see the B Variant. The values should be:
Request Header Name: GOVUK-ABTest-ContentPagesNav
Request Header Value: B

To see Google Analytics events firing in the Dev Tools console, you need an extension like Google Analytics Debugger

@benthorner benthorner temporarily deployed to government-frontend-pr-1054 August 15, 2018 15:03 Inactive
@@ -91,23 +91,42 @@ def load_taxonomy_navigation
.map { |document_collection| document_collection.values_at('base_path', 'title') }

# Fetch link attributes of parent step by steps required to render the top navigation banner
@banner_items = @content_item
@step_by_step_links = @content_item
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need @step_by_step_links, or @taxon_links to be instance variables, only @banner_items.

.sort_by { |taxon| taxon[:taxon_name] }
.map { |taxon| taxon.values_at('title', 'base_path') }
.map { |taxon| taxon.values_at('title', 'base_path') << "Taxon" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to append "Taxon" to the mapped attributes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot, we don't any more, that was my previous attempt at a solution! Will remove

@vanitabarrett vanitabarrett force-pushed the add-tracking-to-taxonomy-nav branch from b12af32 to 2a9faf9 Compare August 15, 2018 15:22
@benthorner benthorner temporarily deployed to government-frontend-pr-1054 August 15, 2018 15:22 Inactive
@vanitabarrett vanitabarrett force-pushed the add-tracking-to-taxonomy-nav branch from 2a9faf9 to aaaf82c Compare August 15, 2018 15:25
@benthorner benthorner temporarily deployed to government-frontend-pr-1054 August 15, 2018 15:25 Inactive
end
end
end

def format_banner_links(links, type)
links.each.with_index(1).map do |link, index|
Copy link
Contributor

@andrewgarner andrewgarner Aug 15, 2018

Choose a reason for hiding this comment

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

You can do map do |(title, base_path), index|, then the arguments supplied to link_to will be a little more expressive.

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.

4 participants