Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
Add dimension for token (#20)
Chris Chuad83045abc01e
diff --git a/examples/demo-app/src/app.js b/examples/demo-app/src/app.jsindex 93d52b2a7..55b097aee 100644--- a/examples/demo-app/src/app.js+++ b/examples/demo-app/src/app.js@@ -45,13 +45,20 @@ class App extends Component {// if we pass an id as part f the url// we ry to fetch along map configurationsconst {params: {id: sampleMapId} = {}} = this.props;- // if (sampleMapId) {this.props.dispatch(loadSampleConfigurations(sampleMapId));if (window.gtag) {- window.gtag('config', 'UA-64694404-19', {- user_id: this.props.location.query.token- });+ const {token} = this.props.location.query;+ window.gtag('set', {token});++ window.gtag('config', 'UA-64694404-19',+ {+ user_id: token,+ custom_map: {dimension1: 'token'}+ }+ );++ window.gtag('send', 'pageview', {token});}}diff --git a/website/src/reducers/index.js b/website/src/reducers/index.jsindex deb880bb2..82fe6ab16 100644--- a/website/src/reducers/index.js+++ b/website/src/reducers/index.js@@ -19,7 +19,7 @@// THE SOFTWARE.import {combineReducers, createStore, applyMiddleware, compose} from 'redux';-import {routerReducer} from 'react-router-redux'+import {routerReducer} from 'react-router-redux';import {taskMiddleware} from 'react-palm';import thunk from 'redux-thunk';import {routerMiddleware} from 'react-router-redux';diff --git a/website/src/routes.js b/website/src/routes.jsindex b7f765f74..f29bec7f2 100644--- a/website/src/routes.js+++ b/website/src/routes.js@@ -21,6 +21,7 @@import React from 'react';import {Router, Route, IndexRoute, hashHistory} from 'react-router';import {syncHistoryWithStore} from 'react-router-redux';+import window from 'global/window';import store from './reducers';import Home from './components/home';@@ -37,6 +38,24 @@ const checkAccessCode = ({location: {pathname, query}}, replace) => {}};+const trackPageChange = (location) => {+ const links = location.split('/');++ if (links.length === 3) {+ const sampleId = links[2];+ window.gtag('event', 'load_sample', {+ event_label: sampleId,+ value: sampleId+ })+ }+};+const history = syncHistoryWithStore(hashHistory, store);+history.listen(location => {+ if (location.action === 'POP' && location.query.token !== 'testkepler') {+ trackPageChange(location.pathname);+ }+});+// eslint-disable-next-line react/display-nameexport default () => (<Router history={syncHistoryWithStore(hashHistory, store)}>diff --git a/website/src/static/index.html b/website/src/static/index.htmlindex bcf4d5f26..0f4a9c9d8 100644--- a/website/src/static/index.html+++ b/website/src/static/index.html@@ -35,7 +35,7 @@function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'UA-64694404-19', {- 'page_path': location.pathname + location.search + location.hash+ page_path: location.pathname + location.search + location.hash});</script>