Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add ga metrics from layers in url, distraction free mode, and data coverage panel

Ed Plato7d54ae94c0db
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index ef6e652ed..51aa84743 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -868,6 +868,9 @@ class Timeline extends React.Component {
* @returns {void}
*/
toggleDataCoveragePanel = (isOpen) => {
+ googleTagManager.pushEvent({
+ event: 'open_data_coverage_panel',
+ });
this.setState({
isDataCoveragePanelOpen: isOpen,
});
diff --git a/web/js/modules/layers/util.js b/web/js/modules/layers/util.js
index 11071696e..f2ed76db9 100644
--- a/web/js/modules/layers/util.js
+++ b/web/js/modules/layers/util.js
@@ -11,6 +11,8 @@ import {
isArray,
} from 'lodash';
+// eslint-disable-next-line import/no-unresolved
+import googleTagManager from 'googleTagManager';
import update from 'immutability-helper';
import { addLayer, resetLayers } from './selectors';
import { getPaletteAttributeArray } from '../palettes/util';
@@ -627,6 +629,12 @@ export function layersParse11(str, config) {
id,
attributes: [],
};
+ googleTagManager.pushEvent({
+ event: 'layer_included_in_url',
+ layers: {
+ id,
+ },
+ });
if (!visible) {
lstate.attributes.push({
id: 'hidden',
@@ -656,6 +664,12 @@ export function layersParse12(stateObj, config) {
id: layerId,
attributes: [],
};
+ googleTagManager.pushEvent({
+ event: 'layer_included_in_url',
+ layers: {
+ id: layerId,
+ },
+ });
// Everything inside parens
const arrayAttr = layerDef.match(/\(.*\)/);
if (arrayAttr) {
diff --git a/web/js/modules/ui/actions.js b/web/js/modules/ui/actions.js
index 3b40b20aa..31e652302 100644
--- a/web/js/modules/ui/actions.js
+++ b/web/js/modules/ui/actions.js
@@ -1,3 +1,6 @@
+// eslint-disable-next-line import/no-unresolved
+import googleTagManager from 'googleTagManager';
+
import { TOGGLE_DISTRACTION_FREE_MODE } from './constants';
import { CLOSE as CLOSE_MODAL } from '../modal/constants';
@@ -6,6 +9,9 @@ export default function toggleDistractionFreeMode() {
const { modal, ui } = getState();
const { isDistractionFreeModeActive } = ui;
const modalIsOpen = modal.isOpen;
+ googleTagManager.pushEvent({
+ event: 'init_distraction_free_mode',
+ });
dispatch({
type: TOGGLE_DISTRACTION_FREE_MODE,
isDistractionFreeModeActive: !isDistractionFreeModeActive,