How to create a map of your customers using Mode and Google Maps API

Stitch is based in Philadelphia, but we have customers all over the world. I used our data and a few apps and resources to generate maps to show where our customers are. We find this useful whenever a member of our team is traveling and wants to find out which customers are in the area.

I started by building a SQL query to tie our customers to their locations. For location data, we rely on data from Clearbit and its Enrichment API. I joined the our internal customer information, stored in our data warehouse, with Clearbit data for the same company and retrieved region, latitude, and longitude fields for each customer's location.

I then switched to the Mode analytics platform to create a Google Map with markers. I pasted in my SQL code, then switched to Mode's Report Builder, where I pasted in some simple JavaScript from the alamode.js library to call the Google Maps JavaScript API. The API lets you customize the results, but I was aiming for simplicity and speed. Here's the code I used:

<link rel="stylesheet" href="https://mode.github.io/alamode/alamode.min.css">
<script src="https://mode.github.io/alamode/alamode.min.js"></script>
<div class="mode-header embed-hidden">
  <h1>{{ title }}</h1>
  <p>{{ description }}</p>
</div>

<div class="mode-grid container">
  <div class="row">
    <div class="col-md-12">
      <mode-table id="table_7c176e57d750" dataset="dataset" options="table_options"></mode-table>
    </div>
  </div>
</div>

<script>
  alamode.googleMap({
    google_maps_api_key: "ourapikey",
    title: "Stitch Customer Locations",
    lat_column: "lat",
    lng_column: "lng",
    label_column: "client_name",
    query_name: "Query 1",
    center_lat: 39.9524,
    center_lng: -75.1636,
    starting_zoom: 2,
    map_type: "roadmap",
    height: 900
  })
</script>

When I ran the report, it produced the nifty map you see at the top of this post.

In this worldwide view the pins for our customers' locations are lumped together pretty closely, so I ran a few additional queries to zero in on each continent, in which I specified where region = 'regionname' and specified the geographic center of each region in the center_lat and center_lng fields. Here are zoomed-in views on Europe, Asia Pacific, South America, and Africa.

Europe

Europe

Asia Pacific

Asia-Pacific

South America

South-Latin-America

Africa

Africa

A few caveats on these maps: They're not 100% accurate, due in part to limitations of the Google Maps API and the data behind it. Also, they don't include a pin for every customer in every location. We rely on Clearbit for location data, and not all companies have a public presence that Clearbit can use to pull data from. Also, some Stitch users sign up with email addresses that we're unable to associate with a company. However, they are directionally accurate most of the time.

Stitch is all over the map

These maps clearly show that no matter where you are, you can use Stitch's ETL platform to save time and money. We have hundreds of customers outside of the US, including many from countries with data localization regulations, including the EU General Data Protection Regulation (GDPR) and the APEC Cross-Border Privacy Rules (CBPR) System. They can meet all of their compliance requirements with Stitch.

The only continent where we lack a presence is Antarctica. If you work for an organization with an Antarctic presence, we've got a deal for you: If you sign up for Stitch now, we'll give you 14 days of unlimited replication for more than 90 data sources, for free — and we'll send you a pair of Stitch socks, because ... Antarctica.

Try Stitch for free for 14 days

  • Unlimited data volume during trial
  • Set up in minutes