Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add missing analytics back, minor modifications on existing analytics, random clean up

Edward Plato4521e73b2a28
diff --git a/web/js/components/animation-widget/animation-widget.js b/web/js/components/animation-widget/animation-widget.js
index 916152c95..3632c84b6 100644
--- a/web/js/components/animation-widget/animation-widget.js
+++ b/web/js/components/animation-widget/animation-widget.js
@@ -5,7 +5,6 @@ import TimeSelector from '../date-selector/date-selector';
import LoopButton from './loop-button';
import PlayButton from './play-button';
import AnimWidgetHeader from './header';
-import googleTagManager from 'googleTagManager';
const RangeHandle = props => {
const { value, offset, dragging, ...restProps } = props;
@@ -114,9 +113,6 @@ class AnimationWidget extends React.Component {
}
onDateChange(date, id) {
const { endDate, startDate } = this.state;
- googleTagManager.pushEvent({
- event: 'GIF_animation_date_case'
- });
if (id === 'start') {
this.setState({
startDate: date
diff --git a/web/js/components/animation-widget/gif-post-creation.js b/web/js/components/animation-widget/gif-post-creation.js
index 86af9960d..db9a716a4 100644
--- a/web/js/components/animation-widget/gif-post-creation.js
+++ b/web/js/components/animation-widget/gif-post-creation.js
@@ -102,10 +102,16 @@ export class GifResults extends Component {
e.stopPropagation();
e.preventDefault();
FileSaver.saveAs(blob, dlURL);
+ let sizeRange = size < 5
+ ? '<5MB'
+ : size >= 5 && size <= 25
+ ? '5MB-25MB'
+ : '>25MB';
+
googleTagManager.pushEvent({
event: 'GIF_download',
GIF: {
- downloadSize: size,
+ downloadSize: sizeRange,
increments: increment,
frameSpeed: speed
}
diff --git a/web/js/components/image-download/panel.js b/web/js/components/image-download/panel.js
index e3c8258d7..185c0562d 100644
--- a/web/js/components/image-download/panel.js
+++ b/web/js/components/image-download/panel.js
@@ -14,7 +14,16 @@ import util from '../../util/util';
import googleTagManager from 'googleTagManager';
const MAX_DIMENSION_SIZE = 8200;
-
+const RESOLUTION_KEY = {
+ '0.125': '30m',
+ '0.25': '60m',
+ '0.5': '125m',
+ '1': '250m',
+ '2': '500m',
+ '4': '1km',
+ '20': '5km',
+ '40': '10km'
+};
/*
* A react component, Builds a rather specific
* interactive widget
@@ -73,7 +82,7 @@ export default class ImageResSelection extends React.Component {
activeCount: layers.length
},
image: {
- resolution: resolution,
+ resolution: RESOLUTION_KEY[resolution],
format: fileType,
worldfile: isWorldfile
}
diff --git a/web/js/components/layer/product-picker/product-picker.js b/web/js/components/layer/product-picker/product-picker.js
index 1cb547e19..216660d85 100644
--- a/web/js/components/layer/product-picker/product-picker.js
+++ b/web/js/components/layer/product-picker/product-picker.js
@@ -257,6 +257,12 @@ ProductPicker.propTypes = {
const mapDispatchToProps = dispatch => ({
addLayer: id => {
+ googleTagManager.pushEvent({
+ 'event': 'layer_added',
+ 'layers': {
+ 'id': id
+ }
+ });
dispatch(addLayer(id));
},
removeLayer: id => {
diff --git a/web/js/components/range-selection/range-selection.js b/web/js/components/range-selection/range-selection.js
index ca97ec129..e74984ed9 100644
--- a/web/js/components/range-selection/range-selection.js
+++ b/web/js/components/range-selection/range-selection.js
@@ -2,7 +2,6 @@ import React from 'react';
import PropTypes from 'prop-types';
import Dragger from './dragger.js';
import DraggerRange from './dragger-range.js';
-import googleTagManager from 'googleTagManager';
import moment from 'moment';
import { timeScaleOptions } from '../../modules/date/constants';
@@ -92,9 +91,6 @@ class TimelineRangeSelector extends React.Component {
*/
onDragStop() {
this.animationDraggerPositionUpdate(this.state.startLocation, this.state.endLocation, false);
- googleTagManager.pushEvent({
- event: 'GIF_animation_dragger'
- });
}
/*
* Update state based on distance range was dragged
diff --git a/web/js/containers/animation-widget.js b/web/js/containers/animation-widget.js
index a8ddde788..e162214ed 100644
--- a/web/js/containers/animation-widget.js
+++ b/web/js/containers/animation-widget.js
@@ -130,6 +130,9 @@ class AnimationWidget extends React.Component {
).then(() => {
onUpdateStartAndEndDate(startDate, endDate);
}).then(() => {
+ googleTagManager.pushEvent({
+ event: 'GIF_create_animated_button'
+ });
toggleGif();
});
});
@@ -158,9 +161,6 @@ class AnimationWidget extends React.Component {
}
onDateChange(date, id) {
const { onUpdateStartDate, onUpdateEndDate } = this.props;
- googleTagManager.pushEvent({
- event: 'GIF_animation_date_case'
- });
if (id === 'start') {
onUpdateStartDate(date);
} else {
diff --git a/web/js/containers/share.js b/web/js/containers/share.js
index 1bff1a88d..b09ae4109 100644
--- a/web/js/containers/share.js
+++ b/web/js/containers/share.js
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import ShareLinks from '../components/toolbar/share/links';
+import googleTagManager from 'googleTagManager';
import { getSharelink, openPromisedSocial } from '../modules/link/util';
import { CopyToClipboard } from 'react-copy-to-clipboard';
import { Checkbox } from '../components/util/checkbox';
@@ -65,6 +66,9 @@ class ShareLinkContainer extends Component {
const { shortLinkKey, isShort, queryString } = this.state;
if (!isShort && shortLinkKey !== queryString) {
this.getShortLink();
+ googleTagManager.pushEvent({
+ event: 'social_link_shorten'
+ });
this.setState({
shortLinkKey: queryString,
isShort: !isShort
@@ -82,6 +86,10 @@ class ShareLinkContainer extends Component {
}
onLinkClick(type) {
const permalink = this.getPermalink();
+ googleTagManager.pushEvent({
+ event: 'social_share_platform',
+ social_type: type
+ });
// If a short link can be generated, replace the full link.
if (type === 'twitter' || type === 'email') {
let promise = this.getShortLink();
diff --git a/web/js/containers/sidebar/footer-content.js b/web/js/containers/sidebar/footer-content.js
index a05b830c6..4ea2f3701 100644
--- a/web/js/containers/sidebar/footer-content.js
+++ b/web/js/containers/sidebar/footer-content.js
@@ -17,13 +17,32 @@ import { toggleListAll } from '../../modules/natural-events/actions';
import { DATA_GET_DATA_CLICK } from '../../modules/data/constants';
class FooterContent extends React.Component {
+ constructor(props) {
+ super(props);
+ this.toggleListAll = this.toggleListAll.bind(this);
+ }
+ toggleListAll() {
+ const {
+ toggleListAll,
+ showAll
+ } = this.props;
+ toggleListAll();
+ if (showAll) {
+ googleTagManager.pushEvent({
+ event: 'natural_events_current_view_only'
+ });
+ } else {
+ googleTagManager.pushEvent({
+ event: 'natural_events_show_all'
+ });
+ }
+ }
render() {
const {
isCompareActive,
compareMode,
isMobile,
activeTab,
- toggleListAll,
onGetData,
changeCompareMode,
addLayers,
@@ -80,7 +99,7 @@ class FooterContent extends React.Component {
className="red"
id="events-footer-checkbox"
label="Only show events in current view"
- onCheck={toggleListAll}
+ onCheck={this.toggleListAll}
text="List All"
checked={!showAll}
/>
diff --git a/web/js/containers/sidebar/layer.js b/web/js/containers/sidebar/layer.js
index c57d6ffdf..fce104e1c 100644
--- a/web/js/containers/sidebar/layer.js
+++ b/web/js/containers/sidebar/layer.js
@@ -332,6 +332,9 @@ const mapDispatchToProps = dispatch => ({
},
onOptionsClick: (layer, title) => {
const key = 'LAYER_OPTIONS_MODAL' + '-' + layer.id;
+ googleTagManager.pushEvent({
+ event: 'sidebar_layer_options'
+ });
dispatch(
toggleCustomContent(key, {
headerText: title || 'Layer Options',
diff --git a/web/js/containers/sidebar/sidebar.js b/web/js/containers/sidebar/sidebar.js
index ef0c062b0..9bf756f95 100644
--- a/web/js/containers/sidebar/sidebar.js
+++ b/web/js/containers/sidebar/sidebar.js
@@ -38,7 +38,12 @@ const resetWorldview = function(e) {
if (window.location.search === '') return; // Nothing to reset
var msg =
'Do you want to reset Worldview to its defaults? You will lose your current state.';
- if (confirm(msg)) document.location.href = '/';
+ if (confirm(msg)) {
+ googleTagManager.pushEvent({
+ event: 'logo_page_reset'
+ });
+ document.location.href = '/';
+ }
};
class Sidebar extends React.Component {
constructor(props) {
diff --git a/web/js/containers/tour.js b/web/js/containers/tour.js
index 9bf193772..97a17fb4b 100644
--- a/web/js/containers/tour.js
+++ b/web/js/containers/tour.js
@@ -83,6 +83,9 @@ class Tour extends React.Component {
storyStep.transition.action
);
this.props.processStepLink(
+ currentStoryId,
+ 1,
+ currentStory.steps.length,
storyStep['stepLink'] + '&tr=' + currentStoryId + transition,
this.props.config,
this.props.renderedPalettes
@@ -171,6 +174,9 @@ class Tour extends React.Component {
storyStep.transition.action
);
this.props.processStepLink(
+ currentStoryId,
+ newStep,
+ currentStory.steps.length,
currentStory.steps[newStep - 1]['stepLink'] +
'&tr=' +
currentStoryId +
@@ -197,6 +203,9 @@ class Tour extends React.Component {
storyStep.transition.action
);
this.props.processStepLink(
+ currentStoryId,
+ newStep,
+ currentStory.steps.length,
currentStory.steps[newStep - 1]['stepLink'] +
'&tr=' +
currentStoryId +
@@ -252,7 +261,6 @@ class Tour extends React.Component {
config,
screenHeight,
screenWidth,
- processStepLink,
isActive,
endTour
} = this.props;
@@ -334,7 +342,6 @@ class Tour extends React.Component {
metaLoaded={metaLoaded}
isLoadingMeta={isLoadingMeta}
description={description}
- processStepLink={processStepLink}
/>
) : (
<TourComplete
@@ -357,13 +364,24 @@ class Tour extends React.Component {
}
const mapDispatchToProps = dispatch => ({
- processStepLink: (search, config, rendered) => {
+ processStepLink: (currentStoryId, currentStep, totalSteps, search, config, rendered) => {
search = search.split('/?').pop();
const location = update(history.location, {
search: { $set: search }
});
let parameters = util.fromQueryString(search);
let layers = [];
+
+ // Record selected story's id, current steps, and total steps to analytics
+ googleTagManager.pushEvent({
+ 'event': 'tour_selected_story',
+ 'story': {
+ 'id': currentStoryId,
+ 'selectedStep': currentStep,
+ 'totalSteps': totalSteps
+ }
+ });
+
dispatch(stopAnimation());
if (
(parameters.l && hasCustomTypePalette(parameters.l)) ||