Geo Lookup without IP
I am curious since we do not gather customer IPs, but we do gather the local from which they select. I am looking for a way to possibly re-code the geo lookup to go off country code. Thoughts so far define country code US = IP 111.111.1.1 and then match case local with country code and trick it to think the IP is 111.111.1.1. I dont need specific lat and long but rather just broad country of origin think it will work?
-
Hi Ashley, yes, this is possible. Alternatively, instead of faking an IP, you could also simply return a latitude and longitude that corresponds to somewhere in each country code for example:
| if(country_code_in_log="US","39.7392") as latitude
| if(country_code_in_log="US","-104.9903") as longitude
| count by latitude,longitude
As long as you have two columns named Latitude and Longitude, the map visualization will display it.
Hope this helps. If for some reason I have misunderstood, let me know and we can chat further.
-
Rather than IP Addresses, consider using a lookup table with the country code in the log.
Find a source csv file of latitude/logitude for each country code and use this file in a search lookup.
For example,
The source file https://raw.githubusercontent.com/google/dspl/master/datasets/google/canonical/countries.csv
country,latitude,longitude,name AD,42.546245,1.601554,Andorra AE,23.424076,53.847818,"United Arab Emirates" AF,33.93911,67.709953,Afghanistan AG,17.060816,-61.796428,"Antigua and Barbuda" AI,18.220554,-63.068615,Anguilla AL,41.153332,20.168331,Albania
.... etcThis lookup file can be integrated as follows:
| lookup latitude,longitude from https://raw.githubusercontent.com/google/dspl/master/datasets/google/canonical/countries.csv on country=country_code_in_log
| count by latitude,longitude -
Please sign in to leave a comment.
Comments
4 comments