Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add ipify metrics

Ed Plato93849c644a7b
diff --git a/web/js/app.js b/web/js/app.js
index 7792c648c..95aab415d 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -139,7 +139,7 @@ class App extends React.Component {
config = self.props.config;
config.parameters = state;
- const main = function() {
+ const main = async function() {
const models = self.props.models;
// Load any additional scripts as needed
@@ -150,6 +150,16 @@ class App extends React.Component {
}
if (config.features.googleTagManager) {
googleTagManager.init(config.features.googleTagManager.id); // Insert google tag manager
+
+ // get user ip address using https://www.ipify.org/ api
+ const response = await fetch('https://api.ipify.org?format=json');
+ const json = await response.json();
+ const ipAddress = await json.ip;
+
+ googleTagManager.pushEvent({
+ event: 'ipAddress',
+ ipAddress: ipAddress
+ });
}
// Console notifications