M _config.yml => _config.yml +1 -0
@@ 93,6 93,7 @@ analytics:
provider : false # false (default), "google", "google-universal", "custom"
google:
tracking_id :
+ anonymize_ip : # true, false (default)
# Site Author
M _includes/analytics-providers/google-gtag.html => _includes/analytics-providers/google-gtag.html +1 -1
@@ 5,5 5,5 @@
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
- gtag('config', '{{ site.analytics.google.tracking_id }}');
+ gtag('config', '{{ site.analytics.google.tracking_id }}', { 'anonymize_ip': {{ site.analytics.google.anonymize_ip | default: false }}});
</script>
M _includes/analytics-providers/google-universal.html => _includes/analytics-providers/google-universal.html +1 -0
@@ 5,5 5,6 @@
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.analytics.google.tracking_id }}', 'auto');
+ ga('set', 'anonymizeIp', {{ site.analytics.google.anonymize_ip | default: false }})
ga('send', 'pageview');
</script>
M _includes/analytics-providers/google.html => _includes/analytics-providers/google.html +3 -0
@@ 1,6 1,9 @@
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ site.analytics.google.tracking_id }}']);
+ {% if site.analytics.google.anonymize_ip == true %}
+ _gaq.push(['_gat._anonymizeIp']);
+ {% endif %}
_gaq.push(['_trackPageview']);
(function() {