diff --git a/website/Gemfile b/website/Gemfile
index d21d35e451..177bf17747 100644
--- a/website/Gemfile
+++ b/website/Gemfile
@@ -1,3 +1,3 @@
source "https://rubygems.org"
-gem "middleman-hashicorp", "0.3.30"
+gem "middleman-hashicorp", "0.3.34"
diff --git a/website/Gemfile.lock b/website/Gemfile.lock
index 8958e299f4..d1b532862f 100644
--- a/website/Gemfile.lock
+++ b/website/Gemfile.lock
@@ -1,16 +1,3 @@
-GIT
- remote: https://github.com/hashicorp/middleman-hashicorp
- revision: 9cd0ee84bfd883d1805a1756ab98e6a54303fd61
- specs:
- middleman-hashicorp (0.3.29)
- bootstrap-sass (~> 3.3)
- builder (~> 3.2)
- middleman (~> 3.4)
- middleman-livereload (~> 3.4)
- middleman-syntax (~> 3.0)
- redcarpet (~> 3.3)
- turbolinks (~> 5.0)
-
GEM
remote: https://rubygems.org/
specs:
@@ -19,7 +6,7 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
- autoprefixer-rails (8.1.0)
+ autoprefixer-rails (8.2.0)
execjs
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
@@ -91,6 +78,14 @@ GEM
rack (>= 1.4.5, < 2.0)
thor (>= 0.15.2, < 2.0)
tilt (~> 1.4.1, < 2.0)
+ middleman-hashicorp (0.3.34)
+ bootstrap-sass (~> 3.3)
+ builder (~> 3.2)
+ middleman (~> 3.4)
+ middleman-livereload (~> 3.4)
+ middleman-syntax (~> 3.0)
+ redcarpet (~> 3.3)
+ turbolinks (~> 5.0)
middleman-livereload (3.4.6)
em-websocket (~> 0.5.1)
middleman-core (>= 3.3)
@@ -118,9 +113,9 @@ GEM
padrino-support (0.12.9)
activesupport (>= 3.1)
rack (1.6.9)
- rack-livereload (0.3.16)
+ rack-livereload (0.3.17)
rack
- rack-test (0.8.3)
+ rack-test (1.0.0)
rack (>= 1.0, < 3)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
@@ -158,7 +153,7 @@ PLATFORMS
ruby
DEPENDENCIES
- middleman-hashicorp!
+ middleman-hashicorp (= 0.3.34)
BUNDLED WITH
1.16.1
diff --git a/website/Makefile b/website/Makefile
index 4d3d361b78..0991a77533 100644
--- a/website/Makefile
+++ b/website/Makefile
@@ -1,4 +1,4 @@
-VERSION?="0.3.28"
+VERSION?="0.3.34"
build:
@echo "==> Starting build in Docker..."
@@ -7,6 +7,7 @@ build:
--rm \
--tty \
--volume "$(shell pwd):/website" \
+ -e "ENV=production" \
hashicorp/middleman-hashicorp:${VERSION} \
bundle exec middleman build --verbose --clean
diff --git a/website/config.rb b/website/config.rb
index 74a8828522..09bbad4a1e 100644
--- a/website/config.rb
+++ b/website/config.rb
@@ -7,6 +7,16 @@ activate :hashicorp do |h|
end
helpers do
+ # Returns a segment tracking ID such that local development is not
+ # tracked to production systems.
+ def segmentId()
+ if (ENV['ENV'] == 'production')
+ 'IyzLrqXkox5KJ8XL4fo8vTYNGfiKlTCm'
+ else
+ '0EXTgkNx0Ydje2PGXVbRhpKKoe5wtzcE'
+ end
+ end
+
# Returns the FQDN of the image URL.
#
# @param [String] path
diff --git a/website/packer.json b/website/packer.json
index cbfb5c565a..d1657eb69e 100644
--- a/website/packer.json
+++ b/website/packer.json
@@ -3,6 +3,7 @@
"aws_access_key_id": "{{ env `AWS_ACCESS_KEY_ID` }}",
"aws_secret_access_key": "{{ env `AWS_SECRET_ACCESS_KEY` }}",
"aws_region": "{{ env `AWS_REGION` }}",
+ "website_environment": "production",
"fastly_api_key": "{{ env `FASTLY_API_KEY` }}"
},
"builders": [
@@ -22,6 +23,7 @@
"AWS_ACCESS_KEY_ID={{ user `aws_access_key_id` }}",
"AWS_SECRET_ACCESS_KEY={{ user `aws_secret_access_key` }}",
"AWS_REGION={{ user `aws_region` }}",
+ "ENV={{ user `website_environment` }}",
"FASTLY_API_KEY={{ user `fastly_api_key` }}"
],
"inline": [
diff --git a/website/source/assets/javascripts/analytics.js b/website/source/assets/javascripts/analytics.js
new file mode 100644
index 0000000000..b4a4f45970
--- /dev/null
+++ b/website/source/assets/javascripts/analytics.js
@@ -0,0 +1,14 @@
+document.addEventListener('DOMContentLoaded', function() {
+ track('.downloads .download .details li a', function(el) {
+ var m = el.href.match(/consul_(.*?)_(.*?)_(.*?)\.zip/)
+ return {
+ event: 'Download',
+ category: 'Button',
+ label: 'Consul | v' + m[1] + ' | ' + m[2] + ' | ' + m[3],
+ version: m[1],
+ os: m[2],
+ architecture: m[3],
+ product: 'consul'
+ }
+ })
+})
diff --git a/website/source/assets/javascripts/application.js b/website/source/assets/javascripts/application.js
index ad181b4cce..51c8914f8f 100644
--- a/website/source/assets/javascripts/application.js
+++ b/website/source/assets/javascripts/application.js
@@ -3,3 +3,6 @@
//= require hashicorp/mega-nav
//= require hashicorp/sidebar
+//= require hashicorp/analytics
+
+//= require analytics
diff --git a/website/source/layouts/layout.erb b/website/source/layouts/layout.erb
index 1430680e96..c8d5cd9477 100644
--- a/website/source/layouts/layout.erb
+++ b/website/source/layouts/layout.erb
@@ -33,13 +33,6 @@
<%= javascript_include_tag "application" %>
-
-
-
@@ -122,14 +115,18 @@