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() analytics.page()
track('.downloads .download .details li a', function(el) { 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 { return {
event: 'Download', event: 'Download',
category: 'Button', category: 'Button',
label: 'Vagrant | v' + m[1] + ' | ' + m[2] + ' | ' + m[3], label: 'Vagrant | v' + version + ' | ' + os + ' | ' + arch,
version: m[1], version: version,
os: m[2], os: os,
architecture: m[3], architecture: arch,
product: 'vagrant' product: 'vagrant'
} }
}) })

View File

@ -43,7 +43,7 @@ description: |-
<h2 class="os-name"><%= pretty_os(os) %></h2> <h2 class="os-name"><%= pretty_os(os) %></h2>
<ul> <ul>
<% arches.each do |arch, url| %> <% 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 %> <% end %>
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>