Get IP of visitor from google analytics - google-analytics

How can I get the IP of the visitor in my google analytics account?
The API of GA https://developers.google.com/apis-explorer/#p/analytics/v3/ provide many information about the location of the visitor such as city, country, etc.. all of them all derived by the IP, However I didn't find the way to get the IP.
Note : I am using the v3 API of GA.

No, GA does not expose the visitors IP anywhere (also in some jurisdictions - e.g. all of the European Union - IP is considered personally identifiable information and would not allowed to be stored unless anonymized by cutting of a part of it, which would probably defy your purpose). Generally, if things are not in the list of dimensions and metrics (and the BigQuery export schema for GA Premium accounts) then they are not available

Related

Google Analytics: Which domains are sending data

Is there a way to tell which sites my Google Analytics tracking code is implemented on? I am suspecting it may have been used with different micro landing pages with different domains and sub-domains. (Our developers were testing a cross domain tracking but did not went as expected)
I could not figure out where to see this on my GA reports, tried to search it but all ends up explaining referrals list which I am not looking for:(
You can check what Hostnames are sending data to the GA reports for a Property, via the Audience > Technology > Network report. Change the Primary Dimension from Service Provider to Hostname.
Filters are not retroactive, so you can instead create and apply a Segment based on Conditions to Filter Sessions Include based on Hostname that exactly matches yourdomain.com.
Doing this will allow you too also view the historical data in your reports in relation to valid Hostname
More info on building segments from the GA Help Center
https://support.google.com/analytics/answer/3124493?hl=en

How do I find visitor name from his / her IP address

While working with Google Analytics, I was thinking how do I get the name of user currently viewing my websites. I Googled and found that many Companies are providing the same & on top of that using GA, like leadfeeder, whoisvisiting etc.
So after doing more research I found a websites that provides IP's ISP full information like name, phone, email etc is https://bgp.he.net, this websites actually pull all the information related to ISP.
I again started more search using ASN number etc, but didn't got any luck. At last I came here at SO. hoping I would get good inputs from experts here.
I am eager to know the working of these companies, how they actually get those names ?
I wanted to know the Name of user or companies visiting my websites, I have no plan to buy the services from any similar services provider companies.
I know its against GDPR, but How those companies are getting the names of visitors?
Thanks in advance
It's also worth to point out that collecting PII information about your users - via Google Analytics - is against Google Analytics policy:
"To protect user privacy, Google policies mandate that no data be passed to Google that Google could use or recognize as personally identifiable information (PII). PII includes, but is not limited to, information such as email addresses, personal mobile numbers, and social security numbers."
Please check more details here: https://support.google.com/analytics/answer/6366371?hl=en
Details of ISPs are publicly known, since they are allocated blocks of IP addresses which they distribute to their customers. The name of those customers are not generally known, and a single IP doesn't necessarily resolve to a single human in the first place. No, you cannot get an individual's name and address from an IP without a subpoena from a court and then requesting that information from the ISP, which knows the identity of the entity to which they allocated the IP. But a court won't grant you that unless you can show any law that IP has broken.

Precise Geolocation reporting using Google Measurement API

I'm having issues with Google Measurement Api. I need to manually report ecommerce transactions to the analytics, and the only data i'm getting from the payment processor is Country Code (which is not precise enough for our analytics process) and IP address of person doing the purchase.
We've tried sending uip (User IP override) param but analytics ignores IP and does not extract the Geolocation from it.
We've tried using geoid, but as i said is not precise. We need city information too. I see that geoid can take integer as param which describes the precise location, but i don't know how to get to that number if only thing i have is IP address.
Any help or advice will be appreciated.
Which hit type do you use?
You must fulfill all mandatory fields of GA measurement protocol so the request could be accepted by GA.
https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters

Can I anonymize IPs in Google Analytics and still track unique visitors?

I am most interested in an answer for Android, though it would be great to know if the answer is generalizable to websites, iOS, etc. Can I anonymize IPs (using setAnonymizeIp()) in Google Analytics and still track unique visitors? I understand Google Analytics uses cookies for websites, and so I thought it might be possible (or perhaps even automatic).
Yes. The only effect that the anonymizeIp function is that it instructs Google to remove the last octet of the IP address from it's logs.
So, if your user's IP is:
123.45.678.90
And you run this function, Google will store it as:
123.45.678.XX
The only practical effect is that this results in less accurate Geographic reporting, but that's it. It won't affect counts of unique visitors in any way, and is totally unrelated to how GA tracks unique visitors, since Google Analytics does not rely on IP addresses for unique visitor identification. For websites, maintaining unique user identification is done by the Google Analytics cookies. In this specific case, the Google Analytics Android SDK handles the user session management for you using a local storage mechanism analogous to cookies.
I dont know if the accepted answer is correct. I've enabled setAnonymizeIp myself on my app, and it had a huge effect on my analytics results.
Pages/visit shot up.
Visits halfed.
Avg time on site shot up.
Ip address is not the value used to identify a unique visitor/user on Google Analytics, so it shouldn't be an issue. Analytics uses a unique identifier in a cookie or mobile app data so attach to all of the user's hits in order to identify as a unique visitor, so I don't see a reason why ip masking should affect it.

Using Google Analytics to Track User Session

I have a PHP (5+) based website.
I want to track registered users of my site using Google Analytics. I basically just wish to grab their session id (or some way to identify each specific user)and view their movements and site usage from my Google Analytics dashboard.
Can this be done? If so, any guidance would be most welcome.
I believe the best way to do this is via a custom variable:
_setCustomVar(index, name, value, opt_scope)
It would be up to you to identify the 'value' as a unique session id for the user.
The scope in your case would be either session(2) or visitor(1) depending on how you want to track it.
http://code.google.com/intl/en/apis/analytics/docs/tracking/gaTrackingCustomVariables.html#setup
Technically you are able to store the username as a custom variable, but doing so violates the Google Analytics Terms of Service (ToS). Among other things, the (paraphrased) ToS states that you aren't allowed to store anything in Google Analytics that allows you to identify who the visitor is. This typically applies to usernames, IP addresses, phone numbers, etc.
If you decide to ignore the ToS and store the data anyway, it exposes YOU (not Google) to all kinds of data protection & PII laws. Especially in the EU.
If you have some budget money to work with, the best way to see the information you're looking for is to use an on premises web analytics software package that can process Google Analytics data. When you keep your data on premises, it alleviates many of the data privacy / protection / PII laws.

Resources