can i use Google Analytics API in my php or javascript code to find the location of visitor of my website ? this link talks about API, but nothing about location of visitor. https://developers.google.com/analytics/devguides/platform/features/experiments-overview
3 Answers
Here is a complete list which dimension and metrics are supported by the GA API: https://developers.google.com/analytics/devguides/reporting/core/dimsmets#cats=visitor,geo/network. You want to look at Geo/Network (and just in case you are asking if you can have geo inforation in realtime on your website from the API, no, GA does not support that). Note that not all combinations of dimensions and metrics are allowed.

- 31,996
- 4
- 43
- 62
You can use IP Geolocation along with the IP Address that google reports.
This is an example provider: http://www.ip2location.com/
It won't be exact, but is often down to the city level, and at worst the next province over. NAT'ed ISP's tend to give false results, for example a Bell Canada cell phone in Nova Scotia often appears in New Brunswick or Quebec.