-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1032 from alphagov/add-tracking-shim
Add Navigation Tracking Metatags shim
- Loading branch information
Showing
5 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
app/views/govuk_component/analytics_meta_tags_navigation.raw.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<% | ||
number_of_sections ||= 0 | ||
number_of_links ||= 0 | ||
%> | ||
|
||
<% content_for :analytics_meta_tags do %> | ||
<meta name="govuk:navigation-sections" content="<%= number_of_sections %>"> | ||
<meta name="govuk:navigation-links" content="<%= number_of_links %>"> | ||
<% end %> |
10 changes: 10 additions & 0 deletions
10
app/views/govuk_component/docs/analytics_meta_tags_navigation.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: Analytics Meta Tags | ||
description: Meta tags to provide analytics information about the current page | ||
body: | | ||
A component that appends counts for navigation elements to the analytics_meta_tags component. | ||
The code which reads the meta tags can be found <a href="https://github.com/alphagov/static/blob/master/app/assets/javascripts/analytics/static-analytics.js#L76-L96">in static-analytics.js</a>. | ||
fixtures: | ||
default: | ||
number_of_sections: 2 | ||
number_of_links: 6 |
13 changes: 13 additions & 0 deletions
13
test/govuk_component/analytics_meta_tags_navigation_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'govuk_component_test_helper' | ||
|
||
class AnalyticsMetaTagsNavigationTestCase < ComponentTestCase | ||
def component_name | ||
"analytics_meta_tags_navigation" | ||
end | ||
|
||
test "no error if no parameters passed in" do | ||
assert_nothing_raised do | ||
render_component({}) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters