diff --git a/README.md b/README.md index a186347..a7f9cef 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Easily add [Wide Angle Analytics](https://wideangle.co) tracker script to your W * Requires at least: 5.2 -* Tested up to: 6.5.2 +* Tested up to: 5.8.2 * Requires PHP: 7.2 diff --git a/readme.txt b/readme.txt index 00c34b3..1355cb2 100644 --- a/readme.txt +++ b/readme.txt @@ -2,9 +2,9 @@ Contributors: jrozanski,inputobjects Tags: web analytics, tracking, web traffic, analytics, statistics, stats Requires at least: 5.2 -Tested up to: 6.5.2 +Tested up to: 5.8.2 Requires PHP: 7.2 -Stable tag: 1.0.9 +Stable tag: 1.0.5 License: GPLv2 Easily add Wide Angle Analytics tracker script to your WordPress site. You can quickly configure your web analytics tracker script. @@ -61,21 +61,7 @@ We run a business around serving the needs of our customer. That's you. You will find most of your answers in the [Knowledge Base](https://wideangle.co/documentation). Should you require further assistance, please [get in touch](https://wideangle.co/support) with our team. == Changelog == -v1.0.9 -- Correct the API type from "supress" to "suppress" - -V1.0.8 -- Expose DNT Flag override -- Test with WordPress 6.5.2 -- Drop un-used ePrivacy flag - -V1.0.7 -- Fix configuration of custom RegEx in the exclusion paths -- Test with WordPress 6.1.1 - -V1.0.6 -- Support for ePrivacy Mode configuration. - V1.0.5 - Support for `data-waa-fingerprint` toggle enabling optional browser fingerprinting. - Fix the header generate to use valid `prefetch` attribute + diff --git a/types/WideAngleAttributes.php b/types/WideAngleAttributes.php index d797dc8..73e3699 100644 --- a/types/WideAngleAttributes.php +++ b/types/WideAngleAttributes.php @@ -6,18 +6,15 @@ class WideAngleAttributes { public $trackerDomain; public $exclusionString; public $includeParamsString; - public $suppressDnt; private $helpers; - public function __construct($siteId, $trackerDomain, $ignoreHash, $exclusionString, $includeParamsString, $fingerprint, $suppressDnt) { + public function __construct($siteId, $trackerDomain, $ignoreHash, $exclusionString, $includeParamsString, $fingerprint) { $this->siteId = $siteId; $this->trackerDomain = $trackerDomain; $this->ignoreHash = $ignoreHash; $this->exclusionString = $exclusionString; $this->includeParamsString = $includeParamsString; $this->fingerprint = $fingerprint; - $this->ePrivacyMode = $ePrivacyMode; - $this->suppressDnt = $suppressDnt; $this->helpers = new WideAngleHelpers(); } @@ -27,7 +24,6 @@ class WideAngleAttributes { 'tracker_domain' => $this->trackerDomain, 'ignore_hash' => $this->ignoreHash, 'fingerprint' => $this->fingerprint, - 'suppress_dnt' => $this->suppressDnt, 'exclusion_paths' => $this->generateExclusionsAttribute(), 'include_params' => $this->generateIncludeParamsAttribute() ); diff --git a/types/WideAngleGenerator.php b/types/WideAngleGenerator.php index fc8ea87..b5131e9 100644 --- a/types/WideAngleGenerator.php +++ b/types/WideAngleGenerator.php @@ -6,7 +6,6 @@ class WideAngleGenerator { public $trackerDomain; public $exclusionPaths; public $includeParams; - public $ePrivacyMode; public function __construct($attributes) { $this->siteId = $attributes['site_id']; @@ -15,7 +14,6 @@ class WideAngleGenerator { $this->exclusionPaths = $attributes['exclusion_paths']; $this->includeParams = $attributes['include_params']; $this->fingerprint = $attributes['fingerprint']; - $this->suppressDnt = $attributes['suppress_dnt']; } @@ -29,17 +27,15 @@ EOD; function generateFooterScript() { $trackerUrlAttribute = esc_attr("https://{$this->trackerDomain}/script/{$this->siteId}.js"); - $pathExlusionsAttribute = $this->exclusionPaths != '' ? "data-waa-exc-paths=\"" . esc_attr($this->exclusionPaths) . "\"": ''; - $includeParamsAttribute = $this->includeParams != '' ? "data-waa-inc-params=\"" . esc_attr($this->includeParams) . "\"": ''; - $ignoreHashAttribute = $this->ignoreHash != '' ? "data-waa-ignore-hash=\"" . esc_attr($this->ignoreHash) . "\"": 'data-waa-ignore-hash="false"'; - $fingerprintAttribute = $this->fingerprint != '' ? "data-waa-fingerprint=\"" . esc_attr($this->fingerprint) . "\"": ''; - $suppressDntAttribute = $this->suppressDnt != '' ? "data-waa-dnt-suppress=\"" . esc_attr($this->suppressDnt) . "\"": 'data-waa-dnt-suppress="false"'; + $pathExlusionsAttribute = $this->exclusionPaths != '' ? "data-waa-exc-paths=\"" . esc_attr($this->exclusionPaths) . "\"": ''; + $includeParamsAttribute = $this->includeParams != '' ? "data-waa-inc-params=\"" . esc_attr($this->includeParams) . "\"": ''; + $ignoreHashAttribute = $this->ignoreHash != '' ? "data-waa-ignore-hash=\"" . esc_attr($this->ignoreHash) . "\"": 'data-waa-ignore-hash="false"'; + $fingerprintAttribute = $this->fingerprint != '' ? "data-waa-fingerprint=\"" . esc_attr($this->fingerprint) . "\"": ''; $script = << EOD; diff --git a/types/WideAngleHelpers.php b/types/WideAngleHelpers.php index 362f5c6..e611eb6 100644 --- a/types/WideAngleHelpers.php +++ b/types/WideAngleHelpers.php @@ -29,14 +29,6 @@ class WideAngleHelpers { } } - function validateSuppressDntFlag($name, $suppressDnt) { - if(filter_var($suppressDnt, FILTER_VALIDATE_BOOLEAN)) { - return WideAngleValidated::createValid($name, $suppressDnt, "true"); - } else { - return WideAngleValidated::createValid($name, $suppressDnt, "false"); - } - } - function validateFingerprint($name, $fingerprint) { if(filter_var($fingerprint, FILTER_VALIDATE_BOOLEAN)) { return WideAngleValidated::createValid($name, $fingerprint, "true"); @@ -86,9 +78,8 @@ class WideAngleHelpers { $valueKey = "waa_exc_path_".$idx[1]."_value"; $sanitizedValue = trim(sanitize_text_field($request[$valueKey])); if($sanitizedValue != null) { - $asRegExp = "/" . wp_unslash($sanitizedValue) . "/"; - if(@preg_match($asRegExp, null) === 0) { - $typedExclusion = "[" . $exclusionType . "]" . filter_var($sanitizedValue, FILTER_SANITIZE_SPECIAL_CHARS); + if(filter_var($sanitizedValue, FILTER_VALIDATE_REGEXP)) { + $typedExclusion = "[" . $exclusionType . "]" . $sanitizedValue; array_push($exclusions, $typedExclusion); } else { $typedExclusion = "[" . $exclusionType . "]" . filter_var($sanitizedValue, FILTER_SANITIZE_SPECIAL_CHARS); diff --git a/views/admin_settings.php b/views/admin_settings.php index 891df3e..85fa48d 100644 --- a/views/admin_settings.php +++ b/views/admin_settings.php @@ -2,7 +2,6 @@ $siteId = wp_unslash($this->settings[self::WAA_CONF_SITE_ID]); $trackerDomain = wp_unslash($this->settings[self::WAA_CONF_TRACKER_DOMAIN]); $ignoreHash = filter_var($this->settings[self::WAA_CONF_IGNORE_HASH], FILTER_VALIDATE_BOOLEAN); -$suppressDnt = filter_var($this->settings[self::WAA_CONF_SUPPRESS_DNT], FILTER_VALIDATE_BOOLEAN); $fingerprint = filter_var($this->settings[self::WAA_CONF_FINGERPRINT], FILTER_VALIDATE_BOOLEAN); $parsedExclusions = $this->plugin->helpers->parseExclusionSetting(wp_unslash($this->settings[self::WAA_CONF_EXC_PATHS])); $parsedIncludeParams = $this->plugin->helpers->parseIncludeParamsSetting(wp_unslash($this->settings[self::WAA_CONF_INC_PARAMS])); @@ -124,19 +123,7 @@ $generator = new WideAngleGenerator($this->settings[self::WAA_CONF_AT /> Ignore -

By default, URL Fragment/hash is trasmitted as part of the tracking event. You can disable this behaviour. The fragment will be stripped before sending an event.

- - - - - -
- Suppress Do-Not-Track - -
-

Wide Angle Analytics respects Do-Not-Track (DNT) browser flag by default. You override this behaviour and always ignore this flag. Please consult relevant laws and regulation whether overriding DNT requires user consent.

+

By default, w URL Fragment/hash is trasmitted as part of the tracking event. You can disable this behaviour. The fragment will be stripped before sending an event.

@@ -167,7 +154,7 @@ $generator = new WideAngleGenerator($this->settings[self::WAA_CONF_AT </head> <!-- .. --> -generateFooterScript())); ?> +generateFooterScript()); ?> diff --git a/wide-angle-analytics.php b/wide-angle-analytics.php index d30e36b..17bc167 100644 --- a/wide-angle-analytics.php +++ b/wide-angle-analytics.php @@ -5,7 +5,7 @@ Description: Easily enable and configure Wide Angle Analytics on your Wordpress site Author: Wide Angle Analytics by Input Objects GmbH Author URI: https://wideangle.co - Version: 1.0.9 + Version: 1.0.5 Requires at least: 5.2 Requires PHP: 7.2 License: GPL v2 @@ -21,7 +21,6 @@ class WideAngleAnalytics { const WAA_CONF_EXC_PATHS = "waa_exc_path"; const WAA_CONF_INC_PARAMS = "waa_inc_params"; const WAA_CONF_IGNORE_HASH = "waa_ignore_hash"; - const WAA_CONF_SUPPRESS_DNT = "waa_suppress_dnt"; const WAA_CONF_ATTRIBUTES = "waa_attributes"; public function __construct() { @@ -39,11 +38,6 @@ class WideAngleAnalytics { "regex" => "RegEx", ); - $this->plugin->ePrivacyModes = array( - "disabled" => "Disable Tracking", - "consent" => "Track assuming consent" - ); - add_action('admin_init', array( &$this, 'registerPluginSettings' ) ); add_action('admin_menu', array( &$this, 'registerAdminMenu' )); @@ -123,12 +117,11 @@ class WideAngleAnalytics { $waaTrackerDomain = $this->plugin->helpers->validateTrackerDomain(self::WAA_CONF_TRACKER_DOMAIN, sanitize_text_field($_REQUEST['waa_tracker_domain'])); $waaIgnoreHash = $this->plugin->helpers->validateIgnoreHashFlag(self::WAA_CONF_IGNORE_HASH, sanitize_text_field($_REQUEST['waa_ignore_hash'])); $waaFingerprint = $this->plugin->helpers->validateFingerprint(self::WAA_CONF_FINGERPRINT, sanitize_text_field($_REQUEST['waa_fingerprint'])); - $waaSuppressDnt = $this->plugin->helpers->validateSuppressDntFlag(self::WAA_CONF_SUPPRESS_DNT, sanitize_text_field($_REQUEST['waa_suppress_dnt'])); $waaIncParams = $this->plugin->helpers->validateIncludeParams(self::WAA_CONF_INC_PARAMS, $_REQUEST); $waaExclusionPaths = $this->plugin->helpers->validateExclusionPathsRequest(self::WAA_CONF_EXC_PATHS, $_REQUEST); include_once( $this->plugin->folder . '/types/WideAngleAttributes.php'); - $merged = array($waaSiteId, $waaTrackerDomain, $waaIgnoreHash, $waaIncParams, $waaExclusionPaths, $waaSuppressDnt); + $merged = array($waaSiteId, $waaTrackerDomain, $waaIgnoreHash, $waaIncParams, $waaExclusionPaths); $errors = array(); foreach($merged as $validated) { if(!$validated->is_valid()) { @@ -143,8 +136,7 @@ class WideAngleAnalytics { $waaIgnoreHash->get_value(), $waaExclusionPaths->get_value(), $waaIncParams->get_value(), - $waaFingerprint->get_value(), - $waaSuppressDnt->get_value() + $waaFingerprint->get_value() ); update_option(self::WAA_CONF_SITE_ID, $waaSiteId->get_value()); update_option(self::WAA_CONF_TRACKER_DOMAIN, $waaTrackerDomain->get_value()); @@ -152,7 +144,6 @@ class WideAngleAnalytics { update_option(self::WAA_CONF_EXC_PATHS, $waaExclusionPaths->get_value()); update_option(self::WAA_CONF_INC_PARAMS, $waaIncParams->get_value()); update_option(self::WAA_CONF_FINGERPRINT, $waaFingerprint->get_value()); - update_option(self::WAA_CONF_SUPPRESS_DNT, $waaSuppressDnt->get_value()); update_option(self::WAA_CONF_ATTRIBUTES, $attributes->generateAttributes()); $this->message = __('Settings updated', $this->plugin->name); } else { @@ -167,7 +158,6 @@ class WideAngleAnalytics { self::WAA_CONF_TRACKER_DOMAIN => get_option(self::WAA_CONF_TRACKER_DOMAIN), self::WAA_CONF_IGNORE_HASH => get_option(self::WAA_CONF_IGNORE_HASH), self::WAA_CONF_FINGERPRINT => get_option(self::WAA_CONF_FINGERPRINT), - self::WAA_CONF_SUPPRESS_DNT => get_option(self::WAA_CONF_SUPPRESS_DNT), self::WAA_CONF_ATTRIBUTES => get_option(self::WAA_CONF_ATTRIBUTES) ); include_once( $this->plugin->folder . '/views/admin_settings.php' ); @@ -182,7 +172,6 @@ class WideAngleAnalytics { * - waa_exc_path * - waa_inc_params * - waa_ignore_hash - * - waa_suppress_dnt * - waa_header_script * - waa_footer_script */ @@ -193,7 +182,6 @@ class WideAngleAnalytics { register_setting($this->plugin->name, self::WAA_CONF_TRACKER_DOMAIN, array('default' => 'stats.wideangle.co')); register_setting($this->plugin->name, self::WAA_CONF_IGNORE_HASH, array('default' => 'false')); register_setting($this->plugin->name, self::WAA_CONF_FINGERPRINT, array('default' => 'false')); - register_setting($this->plugin->name, self::WAA_CONF_SUPPRESS_DNT, array('default' => 'false')); register_setting($this->plugin->name, self::WAA_CONF_ATTRIBUTES, array('type' => 'array')); }