-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
add anonymize ip option for google analytics #8417
Conversation
…hp->getOrdersTrackingCode
@thomas-villagers Thank you for contribution.
|
@vrann Yes, of course! Where would that be done? I could'nt find it in Ga.php. |
return "\nga('create', '" . $this->escapeHtmlAttr($accountId, false) | ||
. ", 'auto');\nga('send', 'pageview'{$optPageURL});\n"; | ||
. ", 'auto');\nga('send', 'pageview'{$optPageURL}{$anonymizeIp});\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you set it globally instead, here?
ga('set', 'anonymizeIp', true);
@thomas-villagers I've added the comment to the code, if you change it to set anonymization globally, it will be applied to other types of hits as well. |
@thomas-villagers looks perfect |
@vrann @thomas-villagers This code is broken, the negative case was never tested. The code is doing a string comparison of |
Hi,
I implemented an option for anonymized ips with google analytics.
The section "Google Analytics" in the backend (Stores > Configuration, Sales > Google API) has a new field "Anonymize IP".
According to the value in Anonymize IP, the ga('send' ...)-call in the generated html is either
ga('send', 'pageview', {'anonymizeIp' : false});
or
ga('send', 'pageview', {'anonymizeIp' : true});
(see https://developers.google.com/analytics/devguides/collection/analyticsjs/ip-anonymization)
this is my first try to extend magento and i'm open to suggestions.