From d4cf8b088ef964f24bcd0268c74e94d7bd8d63c2 Mon Sep 17 00:00:00 2001 From: Jeff Escalante Date: Thu, 27 Sep 2018 20:00:06 -0400 Subject: [PATCH] fix download tracking analytics events --- website/source/assets/javascripts/analytics.js | 12 +++++++----- website/source/downloads.html.erb | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/website/source/assets/javascripts/analytics.js b/website/source/assets/javascripts/analytics.js index e565c5417..3241c50fd 100644 --- a/website/source/assets/javascripts/analytics.js +++ b/website/source/assets/javascripts/analytics.js @@ -2,14 +2,16 @@ document.addEventListener('turbolinks:load', function() { analytics.page() track('.downloads .download .details li a', function(el) { - var m = el.href.match(/vagrant_(.*?)_(.*?)_(.*?)\.zip/) + var version = el.dataset.version + var os = el.dataset.os + var arch = el.dataset.arch return { event: 'Download', category: 'Button', - label: 'Vagrant | v' + m[1] + ' | ' + m[2] + ' | ' + m[3], - version: m[1], - os: m[2], - architecture: m[3], + label: 'Vagrant | v' + version + ' | ' + os + ' | ' + arch, + version: version, + os: os, + architecture: arch, product: 'vagrant' } }) diff --git a/website/source/downloads.html.erb b/website/source/downloads.html.erb index 46f766889..8ab940926 100644 --- a/website/source/downloads.html.erb +++ b/website/source/downloads.html.erb @@ -43,7 +43,7 @@ description: |-

<%= pretty_os(os) %>