Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

added GA #WV-1593

Benjamin139ef580800c
diff --git a/web/js/animation/wv.anim.gif.js b/web/js/animation/wv.anim.gif.js
index a850957a4..f3c3ca4d3 100644
--- a/web/js/animation/wv.anim.gif.js
+++ b/web/js/animation/wv.anim.gif.js
@@ -207,6 +207,7 @@ wv.anim.gif = wv.anim.gif || function(models, config, ui) {
});
return;
}
+ WVTC.GA.event('Animation', 'Click', 'Create GIF');
self.createGIF();
};
@@ -442,6 +443,7 @@ wv.anim.gif = wv.anim.gif || function(models, config, ui) {
var blobURL = URL.createObjectURL(blob); //supported in Chrome and FF
animatedImage.src = blobURL;
var dlURL = wv.util.format("nasa-worldview-{1}-to-{2}.gif", animModel.rangeState.startDate, animModel.rangeState.endDate);
+ var downloadSize = (blob.size / 1024).toFixed();
//Create download link and apply button CSS
var $download = $("<a><span class=ui-button-text>Download</span></a>")
@@ -450,7 +452,10 @@ wv.anim.gif = wv.anim.gif || function(models, config, ui) {
.attr("download", dlURL)
.attr("href", blobURL)
.attr("class", "ui-button ui-widget ui-state-default ui-button-text-only")
- .hover(function() {$(this).addClass("ui-state-hover");}, function() {$(this).removeClass("ui-state-hover");});
+ .hover(function() {$(this).addClass("ui-state-hover");}, function() {$(this).removeClass("ui-state-hover");})
+ .click(function() {
+ WVTC.GA.event('Animation', 'Download', 'GIF', downloadSize);
+ });
var $catalog =
"<div class='gif-results-dialog' style='height: " + animCoords.h + "px; min-height: 210px;' >" +
@@ -459,7 +464,7 @@ wv.anim.gif = wv.anim.gif || function(models, config, ui) {
"Size: " +
"</b></div>" +
"<div>" +
- (blob.size / 1024).toFixed() + " KB" +
+ downloadSize + " KB" +
"</div>" +
"</div>" +
"<div>" +
diff --git a/web/js/animation/wv.anim.widget.js b/web/js/animation/wv.anim.widget.js
index 06d91ed5e..36b124e7b 100644
--- a/web/js/animation/wv.anim.widget.js
+++ b/web/js/animation/wv.anim.widget.js
@@ -44,7 +44,10 @@ wv.anim.widget = wv.anim.widget || function(models, config, ui) {
self.reactComponent = ReactDOM.render(Widget, $('#wv-animation-widet-case')[0]);
$timelineFooter = $('#timeline-footer');
- $animateButton.on('click', self.toggleAnimationWidget);
+ $animateButton.on('click', function() {
+ WVTC.GA.event('Animation', 'Click', 'Animation Icon');
+ self.toggleAnimationWidget();
+ });
if(model.rangeState.state === 'on') { // show animation widget if active in permalink
$timelineFooter.toggleClass('wv-anim-active');
}
diff --git a/web/js/data/wv.data.ui.js b/web/js/data/wv.data.ui.js
index 1f26d8015..89d229d9a 100644
--- a/web/js/data/wv.data.ui.js
+++ b/web/js/data/wv.data.ui.js
@@ -360,6 +360,7 @@ wv.data.ui = wv.data.ui || function(models, ui, config) {
};
var showDownloadList = function() {
+ WVTC.GA.event('Data Download', 'Click', 'Download Button');
if ( selectionListPanel ) {
selectionListPanel.setVisible(false);
}
diff --git a/web/js/image/wv.image.panel.js b/web/js/image/wv.image.panel.js
index 5dda0e286..2b8cb5471 100644
--- a/web/js/image/wv.image.panel.js
+++ b/web/js/image/wv.image.panel.js
@@ -342,14 +342,14 @@ wv.image.panel = wv.image.panel || function(models, ui, config) {
$("#wv-image-width").html((imgWidth));
$("#wv-image-height").html((imgHeight));
$("#wv-image-size").html(icon + imgFilesize + " MB");
- })
- .change();
+ }).change();
- $("#wv-image-download-button").unbind('click').click(function(){
- wv.util.metrics('lc='+encodeURIComponent(dlURL+"&worldfile="+imgWorldfile+"&format="+imgFormat+"&width="+imgWidth+"&height="+imgHeight) );
- window.open(dlURL+"&worldfile="+imgWorldfile+"&format="+imgFormat+"&width="+imgWidth+"&height="+imgHeight,"_blank");
- });
+ $("#wv-image-download-button").unbind('click').click(function() {
+ WVTC.GA.event('Image Download', 'Click', 'Download');
+ wv.util.metrics('lc='+encodeURIComponent(dlURL+"&worldfile="+imgWorldfile+"&format="+imgFormat+"&width="+imgWidth+"&height="+imgHeight) );
+ window.open(dlURL+"&worldfile="+imgWorldfile+"&format="+imgFormat+"&width="+imgWidth+"&height="+imgHeight,"_blank");
+ });
} catch ( cause ) {
wv.util.error(cause);
}
diff --git a/web/js/link/wv.link.ui.js b/web/js/link/wv.link.ui.js
index f7ad182d1..6543f3c20 100644
--- a/web/js/link/wv.link.ui.js
+++ b/web/js/link/wv.link.ui.js
@@ -38,6 +38,7 @@ wv.link.ui = wv.link.ui || function(models, config) {
text: false
}).click(function() {
var checked = $("#wv-link-button-check").prop("checked");
+ WVTC.GA.event('Link', 'Click', 'Share link Button');
if ( checked ) {
self.show();
} else {
@@ -111,6 +112,7 @@ wv.link.ui = wv.link.ui || function(models, config) {
var checked = $("#wv-link-shorten-check").prop("checked");
if ( checked ) {
var promise = models.link.shorten();
+ WVTC.GA.event('Link', 'Check', 'Shorten');
$("#permalink_content").val("Please wait...");
promise.done(function(result) {
if ( result.status_code === 200 ) {
@@ -123,6 +125,7 @@ wv.link.ui = wv.link.ui || function(models, config) {
});
} else {
$('#permalink_content').val(models.link.get());
+ WVTC.GA.event('Link', 'Check', 'Lengthen');
}
$('#permalink_content').focus();
$('#permalink_content').select();
diff --git a/web/js/naturalEvents/wv.naturalEvents.ui.js b/web/js/naturalEvents/wv.naturalEvents.ui.js
index f72dac78b..f94d01d35 100644
--- a/web/js/naturalEvents/wv.naturalEvents.ui.js
+++ b/web/js/naturalEvents/wv.naturalEvents.ui.js
@@ -168,7 +168,9 @@ wv.naturalEvents.ui = wv.naturalEvents.ui || function(models, ui, config) {
refreshEvent($content, event, index);
});
$(self.selector + "content li").click(function() {
- showEvent($(this).attr("data-index"));
+ var dataIndex = $(this).attr("data-index");
+ WVTC.GA.event('Natural Events', 'Click', 'Event');
+ showEvent(dataIndex);
$(self.selector + "content li").removeClass('item-selected');
$(this).addClass('item-selected');
if (wv.util.browser.small){
@@ -177,7 +179,9 @@ wv.naturalEvents.ui = wv.naturalEvents.ui || function(models, ui, config) {
notify();
});
$(self.selector + "content a.date").click(function(event) {
- showEvent($(this).attr("data-index"), $(this).attr("data-date-index"));
+ var dataIndex = $(this).attr("data-index");
+ showEvent(dataIndex, $(this).attr("data-date-index"));
+ WVTC.GA.event('Natural Events', 'Click', 'Event');
event.stopPropagation();
});
resize();
diff --git a/web/js/wv.main.js b/web/js/wv.main.js
index f7ceeb359..adc0bbd1a 100644
--- a/web/js/wv.main.js
+++ b/web/js/wv.main.js
@@ -130,7 +130,9 @@ $(function() {
.register(models.palettes)
.register(models.map);
models.link.load(state);
-
+ if(config.features.googleAnalytics) {
+ WVTC.GA.init(config.features.googleAnalytics.id); // Insert google tracking
+ }
// HACK: Map needs to be created before the data download model
ui.map = wv.map.ui(models, config, wv.map.rotate, wv.map.runningdata);
if ( config.features.animation ) {
diff --git a/web/js/wv.tour.js b/web/js/wv.tour.js
index 65937cffa..58703502f 100644
--- a/web/js/wv.tour.js
+++ b/web/js/wv.tour.js
@@ -155,6 +155,7 @@ wv.tour = wv.tour || function(models, ui, config) {
var onStop = function(index, tip, button) {
//console.log(index, tip, button);
setTourState();
+ WVTC.GA.event('Tour', 'Click', 'Post Tour View', index + 1);
if(index == 5 && button !== "previous") {
endTour();
}
@@ -167,7 +168,7 @@ wv.tour = wv.tour || function(models, ui, config) {
e.stopPropagation();
$(".ui-dialog-content").dialog("close");
initTourState();
-
+ WVTC.GA.event('Tour', 'Click', 'Take Tour');
$('#joyRideTipContent').joyride({
adjustForPhone:false,
bordered:true,