diff --git a/assets/js/visualize/contributors/pack_hierarchy.js b/assets/js/visualize/contributors/pack_hierarchy.js index daecc8bcc..10167157c 100644 --- a/assets/js/visualize/contributors/pack_hierarchy.js +++ b/assets/js/visualize/contributors/pack_hierarchy.js @@ -163,6 +163,10 @@ function draw_pack_hierarchy(areaID) { parentCircles.on('click', clicked); function clicked(o) { + if (typeof _paq !== 'undefined') { + var actionName = o.depth > focus.depth ? 'Drilldown' : 'Drillup'; + _paq.push(['trackEvent', 'Contributions - Projects', actionName, o.data.name]); + } d3.select('#zoomTitle').text(() => { while (o.depth > focus.depth + 1) { o = o.parent; diff --git a/assets/js/visualize/dependencies/force_dependencyGraph.js b/assets/js/visualize/dependencies/force_dependencyGraph.js index c7cb95a02..5d9bc8031 100644 --- a/assets/js/visualize/dependencies/force_dependencyGraph.js +++ b/assets/js/visualize/dependencies/force_dependencyGraph.js @@ -292,6 +292,9 @@ function draw_force_graph(areaID, adjacentAreaID) { .ticks(optionsArray.length - 1) .height(10 * optionsArray.length - 1) .on('onchange', val => { + if (typeof _paq !== 'undefined') { + _paq.push(['trackEvent', 'Dependency Graph', 'Dimension Change', optionsArray[val].text]); + } optionChanged(optionsArray[Math.round(val)]); d3.select('.' + adjacentAreaID).select('g').remove(); }); @@ -545,6 +548,9 @@ function draw_force_graph(areaID, adjacentAreaID) { nodeTip.hide(d); }) .on('click', d => { + if (d && typeof _paq !== 'undefined') { + _paq.push(['trackEvent', 'Dependency Graph', 'Repository - Click', d.id]); + } node.selectAll('circle').each(d => { d['focused'] = false; document.getElementById(d['id']).removeAttribute('searched'); @@ -910,6 +916,9 @@ function draw_force_graph(areaID, adjacentAreaID) { nodeTip.hide(d) }) .on('click', d => { + if (d && typeof _paq !== 'undefined') { + _paq.push(['trackEvent', 'Dependency Graph', 'Repository - Click', d.data.id]); + } nodeTip.hide(d); d = nodes[nodes.findIndex(o => o.id == d.data.id)]; const data = { name: d.name, package: d.package, id: d.id, notPackage: d.notPackage, children: getCurrentNeighbors(d) }; @@ -1023,19 +1032,25 @@ function draw_force_graph(areaID, adjacentAreaID) { function searchForm(event) { event.preventDefault(); + var searchQueryElement = document.getElementById('search').value.toUpperCase(), + rawSearchQueryValue = searchQueryElement.value, + searchQueryValue = rawSearchQueryValue.toUpperCase(); + if (typeof _paq !== 'undefined') { + _paq.push(['trackEvent', 'Dependency Graph', 'Search', searchQueryValue]); + } $('.inGraph').attr('fill-opacity', function(i, d) { - return $(this).attr('id').toUpperCase().includes(document.getElementById('search').value.toUpperCase()) || ($(this).attr('language') && $(this).attr('language').toUpperCase().includes(document.getElementById('search').value.toUpperCase())) ? 1 : 0.2; + return $(this).attr('id').toUpperCase().includes(searchQueryValue) || ($(this).attr('language') && $(this).attr('language').toUpperCase().includes(document.getElementById('search').value.toUpperCase())) ? 1 : 0.2; }); $('.inGraph').attr('stroke-opacity', function(i, d) { - return $(this).attr('id').toUpperCase().includes(document.getElementById('search').value.toUpperCase()) || ($(this).attr('language') && $(this).attr('language').toUpperCase().includes(document.getElementById('search').value.toUpperCase())) ? 1 : 0.2; + return $(this).attr('id').toUpperCase().includes(searchQueryValue) || ($(this).attr('language') && $(this).attr('language').toUpperCase().includes(document.getElementById('search').value.toUpperCase())) ? 1 : 0.2; }); $('.inGraph').attr('r', function(i, d) { - return $(this).attr('id').toUpperCase().includes(document.getElementById('search').value.toUpperCase()) || ($(this).attr('language') && $(this).attr('language').toUpperCase().includes(document.getElementById('search').value.toUpperCase())) ? 6.5 : 5; + return $(this).attr('id').toUpperCase().includes(searchQueryValue) || ($(this).attr('language') && $(this).attr('language').toUpperCase().includes(document.getElementById('search').value.toUpperCase())) ? 6.5 : 5; }); $('.inGraph').attr('searched', function(i, d) { - return $(this).attr('id').toUpperCase().includes(document.getElementById('search').value.toUpperCase()) || (($(this).attr('language') != null) && $(this).attr('language').toUpperCase().includes(document.getElementById('search').value.toUpperCase())); + return $(this).attr('id').toUpperCase().includes(searchQueryValue) || (($(this).attr('language') != null) && $(this).attr('language').toUpperCase().includes(document.getElementById('search').value.toUpperCase())); }); } \ No newline at end of file diff --git a/assets/js/visualize/largeRepos/pie_activityCommits.js b/assets/js/visualize/largeRepos/pie_activityCommits.js index 106aad338..c814a899e 100644 --- a/assets/js/visualize/largeRepos/pie_activityCommits.js +++ b/assets/js/visualize/largeRepos/pie_activityCommits.js @@ -87,6 +87,9 @@ function draw_pie_commits(areaID) { .on('click', clicked); function clicked(d) { + if (typeof _paq !== 'undefined') { + _paq.push(['trackEvent', 'Commits', 'Drill Down', d.label]); + } const pieData = pie(decompress(data)); const scaleCoeff = 2 * Math.PI / (2 * Math.PI - (pieData[pieData.length - 1].endAngle - pieData[pieData.length - 1].startAngle)); let shift = 0; @@ -157,6 +160,9 @@ function draw_pie_commits(areaID) { } function unclicked(d) { + if (typeof _paq !== 'undefined') { + _paq.push(['trackEvent', 'Commits', 'Drillup', d.label]); + } const dur = 1000; const t = chart.transition().duration(dur); diff --git a/assets/js/visualize/largeRepos/sunburst_licenses.js b/assets/js/visualize/largeRepos/sunburst_licenses.js index 176281fb8..c65b4913d 100644 --- a/assets/js/visualize/largeRepos/sunburst_licenses.js +++ b/assets/js/visualize/largeRepos/sunburst_licenses.js @@ -162,6 +162,10 @@ function draw_sunburst_licenses(areaID) { let lastClickedObject = root; function clicked(o) { + if (o.data.name && typeof _paq !== 'undefined') { + var actionName = o.depth > lastClickedObject.depth ? 'Drilldown' : 'Drillup'; + _paq.push(['trackEvent', 'Popular Licenses - Sunburst', actionName, o.data.name]); + } lastClickedObject = o; let newLabel = label.filter(d => labelEverVisible(d)); @@ -222,6 +226,10 @@ function draw_sunburst_licenses(areaID) { }) .ticks(3) .on('onchange', val => { + if (typeof _paq !== 'undefined') { + var humanReadableValue = options[val]; + _paq.push(['trackEvent', 'Popular Licenses - Sunburst', 'Dimension Change', humanReadableValue]); + } data = reformatData(obj, val); root = partition(data); root.each(d => d.current = d); diff --git a/assets/js/visualize/line_repoActivityExplore.js b/assets/js/visualize/line_repoActivityExplore.js index 6bcbc65f5..3da6f4033 100644 --- a/assets/js/visualize/line_repoActivityExplore.js +++ b/assets/js/visualize/line_repoActivityExplore.js @@ -210,6 +210,10 @@ function draw_line_repoActivity(areaID, repoNameWOwner) { .on('mouseover', tip.show) .on('mouseout', tip.hide) .on('click', d => { + if (d && typeof _paq !== 'undefined') { + var value = d.date.getFullYear() + '-' + d.date.getMonth() + '-' + d.date.getDate(); + _paq.push(['trackEvent', 'Line Chart', 'Click', value]); + } tip.hide(d); update(smallX,y); d3.select('#Thanksgiving').attr('y', d => { diff --git a/assets/js/visualize/line_repoStarHistoryExplore.js b/assets/js/visualize/line_repoStarHistoryExplore.js index 6f2946afd..f4112d6d3 100644 --- a/assets/js/visualize/line_repoStarHistoryExplore.js +++ b/assets/js/visualize/line_repoStarHistoryExplore.js @@ -78,6 +78,9 @@ function draw_line_repoStarHistory(areaID) { .tickFormat(d3.format('d')) .default([1, d3.max(flattenedData.map(d => d.value))]) .on('end', val => { + if (val && typeof _paq !== 'undefined') { + _paq.push(['trackEvent', 'Star Chart', 'Filter - Stars', val.join(' - ')]); + } chart.selectAll('g').remove(); var reposInRange = []; for (var repo in data) { diff --git a/assets/js/visualize/sunburst_licenses.js b/assets/js/visualize/sunburst_licenses.js index bdad656bf..5627f55e8 100644 --- a/assets/js/visualize/sunburst_licenses.js +++ b/assets/js/visualize/sunburst_licenses.js @@ -155,6 +155,10 @@ function draw_sunburst_licenses(areaID) { let lastClickedObject = root; function clicked(o) { + if (o.data.name && typeof _paq !== 'undefined') { + var actionName = o.depth > lastClickedObject.depth ? 'Drilldown' : 'Drillup'; + _paq.push(['trackEvent', 'Licenses - Sunburst', actionName, o.data.name]); + } lastClickedObject = o; let newLabel = label.filter(d => labelEverVisible(d)); @@ -215,6 +219,10 @@ function draw_sunburst_licenses(areaID) { }) .ticks(3) .on('onchange', val => { + if (typeof _paq !== 'undefined') { + var humanReadableValue = options[val]; + _paq.push(['trackEvent', 'Licenses - Sunburst', 'Dimension Change', humanReadableValue]); + } data = reformatData(obj, val); root = partition(data); root.each(d => d.current = d);