diff --git a/eth-amp-analytics-wp.php b/eth-amp-analytics-wp.php index 8f7701998e56d6e553006a217be994f3ace57854..106eb4a8fa5481d7163b78dda72a28083cace29d 100644 --- a/eth-amp-analytics-wp.php +++ b/eth-amp-analytics-wp.php @@ -160,7 +160,25 @@ class ETH_AMP_Analytics_WP { * */ public function sanitize_options( $options ) { - return $options; + $sanitized_options = $this->plugin_option_defaults; + + foreach ( $options as $key => $value ) { + switch( $key ) { + case 'property_id' : + $value = trim( $value ); + + if ( preg_match( '#^UA-([\d]+)-([\d]+)$#i', $value ) ) { + $sanitized_options[ $key ] = $value; + } + break; + + default : + // Do nothing, this is unexpected. :) + break; + } + } + + return $sanitized_options; } /**