is it possible to get a geoID for the Geographical Override parameter in the Google Analytics Measurement Protocol from a zipcode or coordinates?
-
Your question is unclear can you please describe what you mean by get? The measurement protocol is for SENDING data to google analytics it does not have any end points that would return data – Linda Lawton - DaImTo Feb 04 '20 at 07:16
-
So I need to call the Measurement Protocol API from my backend API and I want to pass the location of the user to Google Analytics. To pass the location I want to add the geoID parameter. The problem is that I dont know how to get a geoID from a zipcode or coordinates. Hope that this makes sense. – T.Im Feb 04 '20 at 07:42
1 Answers
Geographical Override The geographical location of the user. The geographical ID should be a two letter country code or a criteria ID representing a city or region (see Geographical IDs). This parameter takes precedent over any location derived from IP address, including the IP Override parameter. An invalid code will result in geographical dimensions to be set to '(not set)'.
You will need to download the file found at Geographical IDs and then parse it against some kind of world wide zip code list in order to parse your zipcodes into Geoiids.
Sending a zip code to Google analytics isnt going to work it must be a valid GeoId
format of Googles CSV File
The file from google is a CSV with the following columns Criteria ID,Name,Canonical Name,Parent ID,Country Code,Target Type,Status
"1014315","Sunnyvale","Sunnyvale,California,United States","21137","US","City",Active
- Geoid 1014315
- city Sunnyvale
- Cononical name Sunnyvale,California,United States
- parent id 21137 (i beleave this is state id in the case of the usa)
- country code US
- Active
Note: small towns and villages will probably not be listed. You will have to try to find something as close as you can get

- 1
- 1

- 106,405
- 32
- 180
- 449
-
-
You downloaded the wrong file then the third column is all cities. – Linda Lawton - DaImTo Feb 04 '20 at 08:18
-
I got the right file, but smaller villages are not listet. So I would need to develop an API for getting the nearest city to use it instead of the village. – T.Im Feb 04 '20 at 08:21
-
1This is the list google gives you your going to have to go something as close as you can get. to that village. Small towns will not be listed either the list would be huge if everything was included. – Linda Lawton - DaImTo Feb 04 '20 at 08:23