Merge pull request #10247 from hashicorp/je.fix-download-tracking

Fix download tracking analytics events
This commit is contained in:
Chris Roberts 2018-09-27 17:49:19 -07:00 committed by GitHub
commit 976149b9a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -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'
}
})

View File

@ -43,7 +43,7 @@ description: |-
<h2 class="os-name"><%= pretty_os(os) %></h2>
<ul>
<% arches.each do |arch, url| %>
<li><a href="<%= url %>"><%= pretty_arch(arch) %></a></li>
<li><a data-os="<%= os %>" data-arch="<%= arch%>" data-version="<%= latest_version %>" href="<%= url %>"><%= pretty_arch(arch) %></a></li>
<% end %>
</ul>
<div class="clearfix"></div>