Skip to content

Commit

Permalink
SAK-41039 - Google Analytics: Add support to anonymize the IP
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Pellicer committed Jan 11, 2019
1 parent 155ae3c commit b1cedcd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
#
# portal.google.universal_analytics_id=UA-XXXXXX-XX

# SAK-41039
# Support to anonymize IP in Google Analytics
# Default: false
# portal.google.anonymize.ip = true

# SAK-29668
# Add support for Google Tag Manager
# Google Tag Manager is NOT enabled by default, setting these will enable it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@ public PortalRenderContext startPageContext(String siteType, String title,
String universalAnalyticsId = ServerConfigurationService.getString("portal.google.universal_analytics_id", null);
if ( universalAnalyticsId != null ) {
rcontext.put("googleUniversalAnalyticsId", universalAnalyticsId);
rcontext.put("googleAnonymizeIp", ServerConfigurationService.getBoolean("portal.google.anonymize.ip", false));
}

String analyticsId = ServerConfigurationService.getString("portal.google.analytics_id", null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', '${googleUniversalAnalyticsId}', { 'userId': portal.user.id });
ga('set', 'anonymizeIp', ${googleAnonymizeIp});
ga('send', 'pageview');
</script>

Expand Down

0 comments on commit b1cedcd

Please sign in to comment.