Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

handle merge conflicts with develop branch

Ed Platoaadbb7072515
diff --git a/web/js/animation/gif.js b/web/js/animation/gif.js
index 89d2779fb..bd53abaad 100644
--- a/web/js/animation/gif.js
+++ b/web/js/animation/gif.js
@@ -9,7 +9,7 @@ import lodashThrottle from 'lodash/throttle';
import lodashCapitalize from 'lodash/capitalize';
import canvg from 'canvg-browser';
import FileSaver from 'file-saver';
-import googleAnalytics from '../components/util/google-analytics';
+import googleTagManager from 'googleTagManager';
import GifResSelection from '../components/animation-widget/gif-panel';
import {
imageUtilGetLayerOpacities,
@@ -432,7 +432,15 @@ export function animationGif(models, config, ui) {
});
return;
}
- googleAnalytics.event('Animation', 'Click', 'Create GIF');
+ googleTagManager.pushEvent({
+ 'event': 'GIF_create',
+ 'layers': {
+ 'activeCount': models.layers.active.length
+ },
+ 'GIF': {
+ 'resolution': resolution
+ }
+ });
self.createGIF();
};
@@ -672,7 +680,14 @@ export function animationGif(models, config, ui) {
.click(function(e) {
e.preventDefault();
FileSaver.saveAs(blob, dlURL);
- googleAnalytics.event('Animation', 'Download', 'GIF', downloadSize);
+ googleTagManager.pushEvent({
+ 'event': 'GIF_download',
+ 'GIF': {
+ 'downloadSize': downloadSize,
+ 'increments': ui.anim.widget.getIncrements(),
+ 'frameSpeed': animModel.rangeState.speed
+ }
+ });
});
var $catalog =
diff --git a/web/js/animation/widget.js b/web/js/animation/widget.js
index f3751257e..f96989d3c 100644
--- a/web/js/animation/widget.js
+++ b/web/js/animation/widget.js
@@ -1,5 +1,5 @@
import AnimationWidget from '../components/animation-widget/animation-widget';
-import googleAnalytics from '../components/util/google-analytics';
+import googleTagManager from 'googleTagManager';
import React from 'react';
import ReactDOM from 'react-dom';
import lodashWithout from 'lodash/without';
@@ -55,7 +55,7 @@ export function animationWidget(models, config, ui) {
);
$timelineFooter = $('#timeline-footer');
$animateButton.on('click', function() {
- googleAnalytics.event('Animation', 'Click', 'Animation Icon');
+ googleTagManager.pushEvent({ 'event': 'GIF_setup_animation_button' });
self.toggleAnimationWidget();
});
if (model.rangeState.state === 'on') {
@@ -404,10 +404,22 @@ export function animationWidget(models, config, ui) {
*/
self.onPressGIF = function() {
let zoomLevel = ui.anim.ui.getInterval();
+ let looping = ui.anim.widget.reactComponent.state.looping;
if (zoomLevel !== 'minute') {
// zero out start/end date times
self.setZeroDateTimes();
}
+
+ let increment = self.getIncrements();
+ let frameSpeed = model.rangeState.speed;
+ googleTagManager.pushEvent({
+ 'event': 'GIF_create_animated_button',
+ 'GIF': {
+ 'increment': increment,
+ 'frameSpeed': frameSpeed,
+ 'looping': looping
+ }
+ });
model.events.trigger('gif-click');
};
diff --git a/web/js/app.js b/web/js/app.js
index 21956164e..12ff741e4 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -3,6 +3,7 @@ import React from 'react';
import 'babel-polyfill'; // Needed for worldview-components in IE and older browsers
import lodashEach from 'lodash/each';
import googleAnalytics from './components/util/google-analytics';
+import googleTagManager from './components/util/google-tag-manager';
// Utils
import util from './util/util';
@@ -396,6 +397,9 @@ class App extends React.Component {
if (config.features.googleAnalytics) {
googleAnalytics.init(config.features.googleAnalytics.id); // Insert google tracking
}
+ if (config.features.googleTagManager) {
+ googleTagManager.init(config.features.googleTagManager.id); // Insert google tag manager
+ }
// HACK: Map needs to be created before the data download model
var mapComponents = {
diff --git a/web/js/components/animation-widget/animation-widget.js b/web/js/components/animation-widget/animation-widget.js
index 937a429c1..52538c482 100644
--- a/web/js/components/animation-widget/animation-widget.js
+++ b/web/js/components/animation-widget/animation-widget.js
@@ -5,6 +5,7 @@ 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';
/*
* A react component, Builds a rather specific
@@ -91,6 +92,9 @@ 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/range-selection/range-selection.js b/web/js/components/range-selection/range-selection.js
index d11ad1fa9..3ad186823 100644
--- a/web/js/components/range-selection/range-selection.js
+++ b/web/js/components/range-selection/range-selection.js
@@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import Dragger from './dragger.js';
import DraggerRange from './dragger-range.js';
+import googleTagManager from 'googleTagManager';
/*
* A react component, is a draggable svg
@@ -98,6 +99,9 @@ class TimelineRangeSelector extends React.Component {
*/
onDragStop() {
this.props.onDrag(this.state.startLocation, this.state.endLocation);
+ googleTagManager.pushEvent({
+ 'event': 'GIF_animation_dragger'
+ });
}
/*
* Send callback with click event
diff --git a/web/js/components/sidebar/data/product.js b/web/js/components/sidebar/data/product.js
index 25d0e2a22..a1a44a836 100644
--- a/web/js/components/sidebar/data/product.js
+++ b/web/js/components/sidebar/data/product.js
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import util from '../../../util/util';
+import googleTagManager from 'googleTagManager';
const listId = 'wv-data';
class Data extends React.Component {
@@ -32,6 +33,9 @@ class Data extends React.Component {
<span
onClick={e => {
showUnavailableReason();
+ googleTagManager.pushEvent({
+ 'event': 'data_download_not_available'
+ });
}}
className="link"
>
diff --git a/web/js/components/sidebar/events/event.js b/web/js/components/sidebar/events/event.js
index 45490be71..1af1c6aef 100644
--- a/web/js/components/sidebar/events/event.js
+++ b/web/js/components/sidebar/events/event.js
@@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import util from '../../../util/util';
import lodashFind from 'lodash/find';
+import googleTagManager from 'googleTagManager';
class Event extends React.Component {
/**
@@ -50,6 +51,12 @@ class Event extends React.Component {
deselectEvent();
} else {
selectEvent(event.id, date);
+ googleTagManager.pushEvent({
+ 'event': 'natural_event_selected',
+ 'natural_events': {
+ 'category': event.categories[0].title
+ }
+ });
}
}
/**
diff --git a/web/js/components/sidebar/footer-content.js b/web/js/components/sidebar/footer-content.js
index a184f78ef..612ba1303 100644
--- a/web/js/components/sidebar/footer-content.js
+++ b/web/js/components/sidebar/footer-content.js
@@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import Button from '../util/button';
import ModeSelection from './mode-selection';
+import googleTagManager from 'googleTagManager';
class FooterContent extends React.Component {
render() {
@@ -34,10 +35,20 @@ class FooterContent extends React.Component {
text="+ Add Layers"
id="layers-add"
className="layers-add red"
- onClick={addLayers}
+ onClick={() => {
+ addLayers();
+ googleTagManager.pushEvent({
+ 'event': 'add_layers'
+ });
+ }}
/>
<Button
- onClick={toggleMode}
+ onClick={() => {
+ toggleMode();
+ googleTagManager.pushEvent({
+ 'event': 'comparison_mode'
+ });
+ }}
className="compare-toggle-button"
id="compare-toggle-button"
style={isMobile || !compareFeature ? { display: 'none' } : null}
@@ -62,6 +73,9 @@ class FooterContent extends React.Component {
onClick={() => {
if (filterEventList) {
filterEventList(true);
+ googleTagManager.pushEvent({
+ 'event': 'natural_events_list_all'
+ });
}
}}
text="List All"
@@ -79,7 +93,12 @@ class FooterContent extends React.Component {
return (
<div className="data-download-footer-case">
<Button
- onClick={onGetData}
+ onClick={() => {
+ onGetData();
+ googleTagManager.pushEvent({
+ 'event': 'data_download_button'
+ });
+ }}
className={
noDataSelected
? 'wv-data-download-button black no-pointer-events'
diff --git a/web/js/components/sidebar/sidebar.js b/web/js/components/sidebar/sidebar.js
index 383204762..4ce93bc13 100644
--- a/web/js/components/sidebar/sidebar.js
+++ b/web/js/components/sidebar/sidebar.js
@@ -9,6 +9,7 @@ import { TabContent, TabPane } from 'reactstrap';
import { SidebarProvider as Provider } from './provider';
import CollapsedButton from './collapsed-button';
import NavCase from './nav/nav-case';
+import googleTagManager from 'googleTagManager';
class Sidebar extends React.Component {
constructor(props) {
@@ -89,6 +90,9 @@ class Sidebar extends React.Component {
}
toggleSidebar() {
var isNowCollapsed = !this.state.isCollapsed;
+ googleTagManager.pushEvent({
+ 'event': 'sidebar_chevron'
+ });
if (this.props.localStorage) {
let storageValue = isNowCollapsed ? 'collapsed' : 'expanded';
localStorage.setItem('sidebarState', storageValue);
@@ -324,7 +328,8 @@ Sidebar.propTypes = {
filterEventList: PropTypes.func,
selectedDataProduct: PropTypes.string,
showDataUnavailableReason: PropTypes.func,
- compareFeature: PropTypes.bool
+ compareFeature: PropTypes.bool,
+ projection: PropTypes.string
};
export default Sidebar;
diff --git a/web/js/components/util/google-tag-manager.js b/web/js/components/util/google-tag-manager.js
new file mode 100644
index 000000000..4015b1a5b
--- /dev/null
+++ b/web/js/components/util/google-tag-manager.js
@@ -0,0 +1,47 @@
+/* eslint-disable */
+
+export default {
+ /*
+ * Initialize GTM tracking if tracking
+ * code is present - will add to head in document
+ * noscript will not be handled
+ *
+ * @func init
+ * @static
+ *
+ * @param Category {id} GTM tracking code
+ *
+ * @return {void}
+ */
+ init(id) {
+ if(id) {
+ (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
+ })(window,document,'script','dataLayer',id);
+
+ // create inline SCRIPT tag with dataLayer array and push to HEAD after TITLE tag
+ let dataLayerScript = document.createElement('script');
+ dataLayerScript.type = 'text/javascript';
+ let inlineScript = document.createTextNode('window.dataLayer = window.dataLayer || [];');
+ dataLayerScript.appendChild(inlineScript);
+ document.head.insertBefore(dataLayerScript, document.head.firstElementChild.nextSibling);
+ }
+ },
+
+ /*
+ * @func dataLayerPush object to GoogleTagManager
+ * can add custom javascript object that can be retrieved as custom data layer variables
+ * @static
+ *
+ * @param EventObject {object}
+ *
+ * @return {void}
+ */
+ pushEvent(eventObject) {
+ if (typeof (dataLayer) !== 'undefined') {
+ window.dataLayer.push(eventObject);
+ }
+ }
+};
diff --git a/web/js/data/ui.js b/web/js/data/ui.js
index 45b42238e..3a0e9d826 100644
--- a/web/js/data/ui.js
+++ b/web/js/data/ui.js
@@ -1,6 +1,6 @@
import lodashSize from 'lodash/size';
import lodashEach from 'lodash/each';
-import googleAnalytics from '../components/util/google-analytics';
+import googleTagManager from 'googleTagManager';
import * as olExtent from 'ol/extent';
import { dataMap } from './map';
@@ -42,7 +42,9 @@ export function dataUi(models, ui, config) {
ui.sidebar.events.on('selectTab', function(tab) {
if (tab === 'download') {
- googleAnalytics.event('Data Download', 'Click', 'Data Download Tab');
+ googleTagManager.pushEvent({
+ 'event': 'data_download_tab'
+ });
model.activate();
} else {
model.deactivate();
@@ -154,7 +156,6 @@ export function dataUi(models, ui, config) {
};
self.showDownloadList = function() {
- googleAnalytics.event('Data Download', 'Click', 'Download Button');
if (selectionListPanel) {
selectionListPanel.setVisible(false);
}
@@ -626,10 +627,16 @@ var dataUiDownloadListPanel = function(config, model) {
};
var showWgetPage = function() {
+ googleTagManager.pushEvent({
+ 'event': 'data_download_list_wget'
+ });
dataUiBulkDownloadPage.show(selection, 'wget');
};
var showCurlPage = function() {
+ googleTagManager.pushEvent({
+ 'event': 'data_download_list_curl'
+ });
dataUiBulkDownloadPage.show(selection, 'curl');
};
diff --git a/web/js/date/timeline.js b/web/js/date/timeline.js
index 131d9a25e..a5fd07e39 100644
--- a/web/js/date/timeline.js
+++ b/web/js/date/timeline.js
@@ -1,5 +1,6 @@
import util from '../util/util';
import d3 from 'd3';
+import googleTagManager from 'googleTagManager';
export function timeline(models, config, ui) {
var self = {};
@@ -246,6 +247,9 @@ export function timeline(models, config, ui) {
}
$('#timeline-hide').click(function() {
+ googleTagManager.pushEvent({
+ 'event': 'timeline_hamburger'
+ });
self.toggle();
});
diff --git a/web/js/image/panel.js b/web/js/image/panel.js
index b0b31fe63..146850d17 100644
--- a/web/js/image/panel.js
+++ b/web/js/image/panel.js
@@ -1,7 +1,7 @@
import 'jquery-ui-bundle/jquery-ui';
import * as olProj from 'ol/proj';
import ImageResSelection from '../components/image-panel/select';
-import googleAnalytics from '../components/util/google-analytics';
+import googleTagManager from 'googleTagManager';
import util from '../util/util';
import wvui from '../ui/ui';
import React from 'react';
@@ -378,7 +378,18 @@ export function imagePanel(models, ui, config, dialogConfig) {
imageUtilGetLayerOpacities(products),
url
);
- googleAnalytics.event('Image Download', 'Click', 'Download');
+ googleTagManager.pushEvent({
+ 'event': 'image_download',
+ 'layers': {
+ 'activeCount': models.layers.active.length
+ },
+ 'image': {
+ 'resolution': imgRes,
+ 'format': imgFormat,
+ 'worldfile': imgWorldfile
+ }
+ });
+
util.metrics(
'lc=' +
encodeURIComponent(
diff --git a/web/js/layers/modal.js b/web/js/layers/modal.js
index 419488839..5bd0b334e 100644
--- a/web/js/layers/modal.js
+++ b/web/js/layers/modal.js
@@ -12,6 +12,7 @@ import lodashSortBy from 'lodash/sortBy';
import lodashStartCase from 'lodash/startCase';
import lodashValues from 'lodash/values';
import util from '../util/util';
+import googleTagManager from 'googleTagManager';
export function layersModal(models, ui, config) {
var crumbText;
@@ -360,6 +361,12 @@ export function layersModal(models, ui, config) {
alt: category.title
}).click(function(e) {
drawMeasurements(category);
+ googleTagManager.pushEvent({
+ 'event': 'layers_category',
+ 'layers': {
+ 'category': category.title
+ }
+ });
});
$categoryTitle.append($categoryLink);
@@ -434,6 +441,12 @@ export function layersModal(models, ui, config) {
$categories.isotope({
filter: '.layer-category-' + interestCssName(metaCategoryName)
});
+ googleTagManager.pushEvent({
+ 'event': 'layers_meta_category',
+ 'layers': {
+ 'meta_category': metaCategoryName
+ }
+ });
$nav.find('.layer-category-button').removeClass('nav-selected');
$('label[for=' + $(this).attr('id') + ']').addClass('nav-selected');
});
diff --git a/web/js/layers/model.js b/web/js/layers/model.js
index be7d62141..7c5f810d7 100644
--- a/web/js/layers/model.js
+++ b/web/js/layers/model.js
@@ -6,6 +6,7 @@ import lodashFindIndex from 'lodash/findIndex';
import lodashIsUndefined from 'lodash/isUndefined';
import lodashCloneDeep from 'lodash/cloneDeep';
import util from '../util/util';
+import googleTagManager from 'googleTagManager';
export function layersModel(models, config) {
var self = {};
@@ -27,7 +28,7 @@ export function layersModel(models, config) {
self.clear();
if (config.defaults && config.defaults.startingLayers) {
lodashEach(config.defaults.startingLayers, function(start) {
- self[layerStr] = self.add(start.id, start, layerStr);
+ self[layerStr] = self.add(start.id, start, layerStr, 'reset');
});
}
};
@@ -208,7 +209,7 @@ export function layersModel(models, config) {
return endDate;
};
- self.add = function(id, spec, activeLayerString) {
+ self.add = function(id, spec, activeLayerString, addType) {
activeLayerString = activeLayerString || self.activeLayers;
if (
lodashFind(self[activeLayerString], {
@@ -235,6 +236,15 @@ export function layersModel(models, config) {
} else {
self[activeLayerString].splice(split[activeLayerString], 0, def);
}
+
+ if (self.loaded && addType !== 'natural-event' && addType !== 'reset') {
+ googleTagManager.pushEvent({
+ 'event': 'layer_added',
+ 'layers': {
+ 'id': id
+ }
+ });
+ }
self.events.trigger('add', def, null, self[activeLayerString]);
self.events.trigger('change');
return self[activeLayerString];
diff --git a/web/js/link/ui.js b/web/js/link/ui.js
index 58f036f5d..5381207ca 100644
--- a/web/js/link/ui.js
+++ b/web/js/link/ui.js
@@ -5,7 +5,7 @@ import React from 'react';
import ReactDOM from 'react-dom';
import Clipboard from 'clipboard';
import Share from '../components/share/share';
-import googleAnalytics from '../components/util/google-analytics';
+import googleTagManager from 'googleTagManager';
import util from '../util/util';
import wvui from '../ui/ui';
@@ -34,7 +34,9 @@ export function linkUi(models, config) {
})
.click(function() {
var checked = $('#wv-link-button-check').prop('checked');
- googleAnalytics.event('Link', 'Click', 'Share link Button');
+ googleTagManager.pushEvent({
+ 'event': 'social_link_share'
+ });
if (checked) {
self.show();
} else {
@@ -114,6 +116,10 @@ export function linkUi(models, config) {
var shareMessage = 'Check out what I found in NASA Worldview!';
var twMessage = 'Check out what I found in #NASAWorldview -';
var emailBody = shareMessage + ' - ' + url;
+ googleTagManager.pushEvent({
+ 'event': 'social_share_platform',
+ 'social_type': type
+ });
switch (type) {
case 'twitter':
@@ -249,7 +255,9 @@ export function linkUi(models, config) {
var checked = $('#wv-link-shorten-check').prop('checked');
if (checked) {
var promise = models.link.shorten();
- googleAnalytics.event('Link', 'Check', 'Shorten');
+ googleTagManager.pushEvent({
+ 'event': 'social_link_shorten'
+ });
$('#permalink_content').val('Please wait...');
promise
.done(function(result) {
@@ -264,7 +272,6 @@ export function linkUi(models, config) {
});
} else {
$('#permalink_content').val(models.link.get());
- googleAnalytics.event('Link', 'Check', 'Lengthen');
}
$('#permalink_content').focus();
$('#permalink_content').select();
diff --git a/web/js/natural-events/markers.js b/web/js/natural-events/markers.js
index 8c84f4bf7..32f72fcea 100644
--- a/web/js/natural-events/markers.js
+++ b/web/js/natural-events/markers.js
@@ -9,6 +9,7 @@ import OlLayerVector from 'ol/layer/Vector';
import OlSourceVector from 'ol/source/Vector';
import OlGeomPolygon from 'ol/geom/Polygon';
import * as olProj from 'ol/proj';
+import googleTagManager from 'googleTagManager';
export default function markers (models, ui) {
var self = {};
@@ -132,6 +133,12 @@ export default function markers (models, ui) {
pinEl.addEventListener('click', function (e) {
if (willSelect && !isSelected) {
ui.naturalEvents.selectEvent(event.id, date);
+ googleTagManager.pushEvent({
+ 'event': 'natural_event_selected',
+ 'natural_events': {
+ 'category': category.title
+ }
+ });
} else {
passEventToTarget(e, olViewport);
}
diff --git a/web/js/natural-events/ui.js b/web/js/natural-events/ui.js
index 181fd9ccc..71f9bd8ed 100644
--- a/web/js/natural-events/ui.js
+++ b/web/js/natural-events/ui.js
@@ -8,7 +8,7 @@ import track from './track';
import wvui from '../ui/ui';
import util from '../util/util';
import { naturalEventsUtilGetEventById } from './util';
-import googleAnalytics from '../components/util/google-analytics';
+import googleTagManager from 'googleTagManager';
const zoomLevelReference = {
Wildfires: 8,
@@ -65,7 +65,9 @@ export default function naturalEventsUI(models, ui, config, request) {
ui.sidebar.events.on('selectTab', function(tab) {
if (tab === 'events') {
model.active = true;
- googleAnalytics.event('Natural Events', 'Click', 'Events Tab');
+ googleTagManager.pushEvent({
+ 'event': 'natural_events_tab'
+ });
// Remove previously stored markers
naturalEventMarkers.remove(self.markers);
@@ -359,7 +361,8 @@ export default function naturalEventsUI(models, ui, config, request) {
{
visible: visible
},
- layerString
+ layerString,
+ 'natural-event'
);
}
});
diff --git a/web/js/projection/ui.js b/web/js/projection/ui.js
index f60b17dc8..42a1793e9 100644
--- a/web/js/projection/ui.js
+++ b/web/js/projection/ui.js
@@ -1,6 +1,7 @@
import 'jquery-ui-bundle/jquery-ui';
import lodashEach from 'lodash/each';
import wvui from '../ui/ui';
+import googleTagManager from 'googleTagManager';
export function projectionUi(models, config) {
var self = {};
@@ -60,6 +61,10 @@ export function projectionUi(models, config) {
'</i>' + ui.name + '</a></li>');
$menuItems.append($item);
$item.click(function () {
+ googleTagManager.pushEvent({
+ 'event': 'change_projection',
+ 'projection': ui.name
+ });
models.proj.select(ui.id);
$('#wv-proj-button-check')
.prop('checked', false);
diff --git a/web/js/sidebar/ui.js b/web/js/sidebar/ui.js
index 12e399951..c89afab26 100644
--- a/web/js/sidebar/ui.js
+++ b/web/js/sidebar/ui.js
@@ -12,6 +12,7 @@ import { layersInfo } from '../layers/info';
import { getZotsForActiveLayers } from '../layers/util';
import { timelineDataHightlight } from '../date/util';
import wvui from '../ui/ui';
+import googleTagManager from 'googleTagManager';
export function sidebarUi(models, config, ui) {
var isCollapsed = false;
@@ -354,6 +355,9 @@ export function sidebarUi(models, config, ui) {
updateState(getStateType(isCompareMode));
break;
case 'info':
+ googleTagManager.pushEvent({
+ 'event': 'sidebar_layer_info'
+ });
let $infoDialog = $('#wv-layers-info-dialog');
if (
$infoDialog.attr('data-layer') !== layerId ||
@@ -367,6 +371,9 @@ export function sidebarUi(models, config, ui) {
break;
case 'options':
+ googleTagManager.pushEvent({
+ 'event': 'sidebar_layer_options'
+ });
let $optionDialog = $('#wv-layers-options-dialog');
if (
$optionDialog.attr('data-layer') !== layerId ||
diff --git a/web/js/tour.js b/web/js/tour.js
index d26410aa6..3af1290ea 100644
--- a/web/js/tour.js
+++ b/web/js/tour.js
@@ -2,7 +2,7 @@ import 'jquery-ui-bundle/jquery-ui';
import 'jquery.joyride';
import util from './util/util';
import wvui from './ui/ui';
-import googleAnalytics from './components/util/google-analytics';
+import googleTagManager from 'googleTagManager';
import feedbackModal from './feedback';
export default function(models, ui, config) {
@@ -121,6 +121,9 @@ export default function(models, ui, config) {
closeText: ''
});
feedbackModal.decorate($dialog.find('.feedback'));
+ googleTagManager.pushEvent({
+ 'event': 'tour_completed'
+ });
$('#repeat').click(repeatTour);
$('#done').click(handleDone);
};
@@ -163,7 +166,6 @@ export default function(models, ui, config) {
var onStop = function(index, tip, button) {
setTourState();
- googleAnalytics.event('Tour', 'Click', 'Post Tour View', index + 1);
if (index === 5 && button === false) {
endTour();
}
@@ -176,7 +178,9 @@ export default function(models, ui, config) {
e.stopPropagation();
$('.ui-dialog-content').dialog('close');
initTourState();
- googleAnalytics.event('Tour', 'Click', 'Take Tour');
+ googleTagManager.pushEvent({
+ 'event': 'tour_start'
+ });
$('#joyRideTipContent').joyride({
scroll: false,
autoStart: true,
diff --git a/webpack.config.js b/webpack.config.js
index bc321f427..35ebd22d4 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -55,6 +55,11 @@ if (process.env.TESTING_MODE === 'true') {
*/
module.exports = {
+ resolve: {
+ alias: {
+ googleTagManager$: path.resolve(__dirname, './web/js/components/util/google-tag-manager.js')
+ }
+ },
mode: devMode ? 'development' : 'production',
stats: {
// reduce output text on build - remove for more verbose