fix download tracking analytics events

This commit is contained in:
Jeff Escalante 2018-09-27 20:00:06 -04:00
parent b5cb5f300b
commit d4cf8b088e
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>