GA GEO Chart cities labeled incorrectly

I have a page that connects to a google analytics account. On the page I have a GEO chart focused on the state of Florida.

When I hover over the markers on the map, about half of the markers appear to be correct. The other half are labeled with city names that dont match their marker on the map. Like markers in the middle of the state being labeled as a city in Brazil For examples see the screenshots below.

  • How to send 'custom variables' parameters in Measurement Protocol(GA)?
  • Tracking PDFs generated by WordPress backend with Google Analytics
  • Google Tag Manger with AngularJS?
  • Accessing Google Analytics API data from javascript without authentication
  • Using and querying Custom Dimensions in Google Analytics API
  • How to obtain Google Analytics visitor unique id?
  • Here’s my code that sets up the GEO Charts. Any idea what Im doing wrong?

    Also here is a jsbin

    (function(w,d,s,g,js,fjs){
      g=w.gapi||(w.gapi={});g.analytics={q:[],ready:function(cb){this.q.push(cb);}};
      js=d.createElement(s);fjs=d.getElementsByTagName(s)[0];
      js.src='https://apis.google.com/js/platform.js';
      fjs.parentNode.insertBefore(js,fjs);js.onload=function(){g.load('analytics');};
    }(window,document,'script'));
    
    
    
    
    gapi.analytics.ready(function() {
    
      var CLIENT_ID = '663097249213-ankiu39ud1m7imaa4r5h5mtt4bnpp9b5.apps.googleusercontent.com';
    
      gapi.analytics.auth.authorize({
        container: 'auth-button',
        clientid: CLIENT_ID,
      });
    
      var viewSelector = new gapi.analytics.ViewSelector({
       container: 'view-selector'
      });
    
      var stateMap = new gapi.analytics.googleCharts.DataChart({
        query: {
          'dimensions': 'ga:city',
          'metrics': 'ga:sessions',
          'start-date': '14daysAgo',
          'end-date': 'yesterday',
        },
        chart: {
          type: 'GEO',
          container: 'state',
          options: {
            region: 'US-FL', 
            resolution: 'metros',
            displayMode: 'markers',
            width:'100%',
            height:'100%',
            keepAspectRatio:true
          }
        }
      });
    
    
    
      gapi.analytics.auth.on('success', function(response) {
        viewSelector.execute();
        $('#auth-button').hide();
      });
    
    
    
      viewSelector.on('change', function(ids) {
        var newIds = {
          query: {
            ids: ids
          }
        };
        stateMap.set(newIds).execute();
      });
    });
    

    Here are the request headers:

    Remote Address:74.125.137.95:443
    Request URL:https://content.googleapis.com/analytics/v3/data/ga?start-date=7daysAgo&end-date=yesterday&dimensions=ga%3AuserType&metrics=ga%3Asessions&sort=-ga%3Asessions&max-results=9&ids=ga%3A91097884&output=dataTable&embedApiVersion=v1
    Request Method:GET
    Status Code:200 OK
    Request Headers
    :host:content.googleapis.com
    :method:GET
    :path:/analytics/v3/data/ga?start-date=7daysAgo&end-date=yesterday&dimensions=ga%3AuserType&metrics=ga%3Asessions&sort=-ga%3Asessions&max-results=9&ids=ga%3A91097884&output=dataTable&embedApiVersion=v1
    :scheme:https
    :version:HTTP/1.1
    accept:*/*
    accept-encoding:gzip,deflate,sdch
    accept-language:en-US,en;q=0.8
    authorization:Bearer ya29.qgAhgT4Oq1u6e_cfcv1qP2ieP_QUbPM0WozLPpagwZ_9rmXM8G0s0uDK
    cache-control:no-cache
    pragma:no-cache
    referer:https://content.googleapis.com/static/proxy.html?jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.FnxxMUT2ulE.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Ft%3Dzcms%2Frs%3DAGLTcCMEC-DWdYC4P42L_5byzwhSZYF3Cg
    user-agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36
    x-client-data:CJe2yQEIprbJAQiptskBCMG2yQEI8IjKAQiPlMoBCN6WygE=
    x-clientdetails:appVersion=5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_0)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F38.0.2125.104%20Safari%2F537.36&platform=MacIntel&userAgent=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_0)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F38.0.2125.104%20Safari%2F537.36
    x-goog-encode-response-if-executable:base64
    x-javascript-user-agent:google-api-javascript-client/1.1.0-beta
    x-origin:http://affordable-glass.com
    x-referer:http://affordable-glass.com
    Query String Parametersview sourceview URL encoded
    start-date:7daysAgo
    end-date:yesterday
    dimensions:ga:userType
    metrics:ga:sessions
    sort:-ga:sessions
    max-results:9
    ids:ga:91097884
    output:dataTable
    embedApiVersion:v1
    Response Headers
    alternate-protocol:443:quic,p=0.01
    cache-control:private, max-age=0, must-revalidate, no-transform
    content-encoding:gzip
    content-length:555
    content-type:application/json; charset=UTF-8
    date:Sun, 26 Oct 2014 00:35:09 GMT
    etag:"C7PuqpcNYAngGhjHeeJxl43WaQM/65Qv4TMpW0C9gHm-VUHXAtDeU9g"
    expires:Sun, 26 Oct 2014 00:35:09 GMT
    server:GSE
    status:200 OK
    vary:Referer
    vary:X-Origin
    vary:Origin
    version:HTTP/1.1
    x-content-type-options:nosniff
    x-frame-options:SAMEORIGIN
    x-xss-protection:1; mode=block
    

    Here is the data that gets returned by Google:

    {
      "kind": "analytics#gaData",
      "id": "https://www.googleapis.com/analytics/v3/data/ga?ids=ga:91097884&dimensions=ga:city&metrics=ga:sessions&start-date=14daysAgo&end-date=yesterday",
      "query": {
        "start-date": "14daysAgo",
        "end-date": "yesterday",
        "ids": "ga:91097884",
        "dimensions": "ga:city",
        "metrics": ["ga:sessions"],
        "start-index": 1,
        "max-results": 1000
      },
      "itemsPerPage": 1000,
      "totalResults": 47,
      "selfLink": "https://www.googleapis.com/analytics/v3/data/ga?ids=ga:91097884&dimensions=ga:city&metrics=ga:sessions&start-date=14daysAgo&end-date=yesterday",
      "profileInfo": {
        "profileId": "91097884",
        "accountId": "54755159",
        "webPropertyId": "UA-54755159-1",
        "internalWebPropertyId": "87741876",
        "profileName": "All Web Site Data",
        "tableId": "ga:91097884"
      },
      "containsSampledData": false,
      "columnHeaders": [{
        "name": "ga:city",
        "columnType": "DIMENSION",
        "dataType": "STRING"
      }, {
        "name": "ga:sessions",
        "columnType": "METRIC",
        "dataType": "INTEGER"
      }],
      "totalsForAllResults": {
        "ga:sessions": "75"
      },
      "dataTable": {
        "cols": [{
          "id": "ga:city",
          "label": "ga:city",
          "type": "string"
        }, {
          "id": "ga:sessions",
          "label": "ga:sessions",
          "type": "number"
        }],
        "rows": [{
          "c": [{
            "v": "(not set)"
          }, {
            "v": "3"
          }]
        }, {
          "c": [{
            "v": "Ashburn"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Atlanta"
          }, {
            "v": "4"
          }]
        }, {
          "c": [{
            "v": "Bari"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Belo Horizonte"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Biloxi"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Birmingham"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Bradenton"
          }, {
            "v": "2"
          }]
        }, {
          "c": [{
            "v": "Chandler"
          }, {
            "v": "2"
          }]
        }, {
          "c": [{
            "v": "Columbus"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Cordoba"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Dallas"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Eastpoint"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Erlanger"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Fort Bragg"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Foz do Iguacu"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Fresno"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Funchal"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Houston"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Jacksonville"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Lake Oswego"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Lake Worth"
          }, {
            "v": "2"
          }]
        }, {
          "c": [{
            "v": "Londrina"
          }, {
            "v": "2"
          }]
        }, {
          "c": [{
            "v": "Lynn Haven"
          }, {
            "v": "2"
          }]
        }, {
          "c": [{
            "v": "Mar del Plata"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Marianna"
          }, {
            "v": "2"
          }]
        }, {
          "c": [{
            "v": "Middletown"
          }, {
            "v": "2"
          }]
        }, {
          "c": [{
            "v": "Miramar Beach"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Montreal"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Navarre"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Panama City"
          }, {
            "v": "9"
          }]
        }, {
          "c": [{
            "v": "Panama City Beach"
          }, {
            "v": "7"
          }]
        }, {
          "c": [{
            "v": "Pecan Grove"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Porto Alegre"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Providence"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Rio de Janeiro"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Sabadell"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Sao Paulo"
          }, {
            "v": "3"
          }]
        }, {
          "c": [{
            "v": "Seria"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Surrey"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Tallahassee"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Tampa"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "The Woodlands"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Toronto"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Virginia Beach"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Wellington"
          }, {
            "v": "1"
          }]
        }, {
          "c": [{
            "v": "Wyndham"
          }, {
            "v": "1"
          }]
        }]
      }
    }

  • Google Analytics Embed API: How to retireve access token?
  • Getting Specific Google Analytics Goal Funnel Stage
  • How to send 'custom variables' parameters in Measurement Protocol(GA)?
  • What happens to Google Analytics when I run the page locally?
  • Accessing Google Analytics API data from javascript without authentication
  • Google analytics embed api deauthorize
  • One Solution collect form web for “GA GEO Chart cities labeled incorrectly”

    I have been working with the GEO chart for the EMBED api and had the exact same issues. It seems to me that the GEO chart is pretty feature limited, and the region you set has no bearing on what data it shows, but instead, only zooms the map to the appropriate viewing area. I added a filter to my query, I think this will work for you…

    "query": {
        "start-date": "14daysAgo",
        "end-date": "yesterday",
        "ids": "ga:91097884",
        "dimensions": "ga:city",
        "metrics": ["ga:sessions"],
        "start-index": 1,
        "max-results": 1000,
        "filters": "ga:region==Florida"
     },
    

    Note the last line with the filter, I know this may not be ideal, but it is the only way I could get the Embed GEO chart to work properly.