<?php /** * Site Kit by Google Anonymize IPs plugin file. * * @package Google\Site_Kit_Anomyize_IPs * @author Felix Arntz, Google * @license GPL-2.0-or-later * @copyright 2019 Google Inc. * * @wordpress-plugin * Plugin Name: Site Kit by Google Anonymize IPs * Description: Ensures the inserted Google Analytics snippet anonymizes IP addresses. * Plugin URI: https://gist.github.com/felixarntz/2800ed9abfa13aabfa6e5c8ba9ec5066 * Version: 0.1.0 * Author: Felix Arntz, Google * Author URI: https://felix-arntz.me * License: GNU General Public License v2 (or later) * License URI: https://www.gnu.org/licenses/gpl-2.0.html */ namespace Google\Site_Kit_Anomyize_IPs; /* * We only need to filter Analytics options for non-AMP, since in AMP (the filter would be 'googlesitekit_amp_gtag_opt') anonymizing IPs is enabled by default * (see https://github.com/ampproject/amphtml/blob/master/extensions/amp-analytics/0.1/vendors/gtag.js#L50). */ add_filter( 'googlesitekit_gtag_opt', function( array $options ) { // See https://developers.google.com/analytics/devguides/collection/gtagjs/ip-anonymization. $options['anonymize_ip'] = true; return $options; } );