Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send IP address #33

Open
coccoinomane opened this issue Sep 5, 2016 · 3 comments
Open

Send IP address #33

coccoinomane opened this issue Sep 5, 2016 · 3 comments

Comments

@coccoinomane
Copy link

Hello!

First of all, thank you for this nice tool. I prefer it over other the alternatives because it is simple and lightweight. Well done!

Now, as for the issue: would it be possible to support in GMPC the IP override parameter? I am referring to the 'uip' parameter from https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#uip.

A bit of context. I often set IP-based filters in my GA views. When I use GMPC, however, the IP sent to GA seems to be the server IP rather than the client IP.

If needed, I have written a function based on a Stack Overflow answer in order to extract the client IP; you can find the function here: https://gist.github.com/coccoinomane/4c420776dc16d80ea772aff06d3e1ef4

Thank you,
Guido

@coccoinomane
Copy link
Author

coccoinomane commented Sep 5, 2016

A follow up: while having the IP information sent would still be a useful feature, it appears that it would not solve the issue about IP filtering.

Apparently, IP addresses sent via the Measurement Protocol are automatically anonymized (just as if aip were used). In other words, if you send uip=1.2.3.4 it will be anonymized to 1.2.3.0 so any specific filter looking for 1.2.3.4 will fail to match (see this Google ticket).

This means that filters are bound to be inefficient as they can only act on the first three blocks of the IP address. More details in this StackOverflow answer.

I have tested this behaviour by including my ip address in an exclude-filter in GA, and by adding the following line to getTrackingPayloadData():

$payloadData['uip'] = '<my ip address>';

Even though the IP data was sent correctly, the filters in GA didn't fire.

In my humble opinion, the case for implementing this feature still stands, as sending the correct IP in anonymized form is in most cases more useful than always sending the server IP.

@ins0
Copy link
Owner

ins0 commented Sep 5, 2016

Hey @coccoinomane thanks for your suggestion, i will look into this and try to give some feedback 👍

@coccoinomane
Copy link
Author

Hi ins0! I have sent a pull request that forces the tracker to send IP information as well, in anomyzed form. It works for me both locally and on a website I have on SiteGround. Please let me know if you need any clarifications :-)
Cheers,
Guido

coccoinomane added a commit to Idearia/wordpress-analytics that referenced this issue May 9, 2017
coccoinomane added a commit to Idearia/wordpress-analytics that referenced this issue May 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants