You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Sir, I also found problems with options section in: /classes/utils.php
Primarily with buildAnalyticsOptions functions
protected static function buildAnalyticsOptions(Config $config): string
{
$options = [];
if ($config->get('plugins.google-analytics.anonymize_ip', true)) {
// The button by default is disabled!! so either negate the condition or set the value to true
// $options['anonymize_ip'] = false;
// I think setting true is better, more consistent with the variable name
$options['anonymize_ip'] = true;
}
There is also a problem with empty $options, since json_encode() returns empty brackets [] instead of empty value
Also you are replacing wrong quotes, we should care about single quotes, since double quotes are treated well with json_encode
// current return value is [] if array is empty
return str_replace('"', '\'', json_encode($options));
// proposed, we return empty string if array is empty
return str_replace("'", '\'', empty($options) ? '' : json_encode($options));
}
The text was updated successfully, but these errors were encountered:
This issue does totally prevent Google Analytics from registering any page views. My first instinct was to just check for a string of [], but your way makes more sense. I copied that as a pull request.
Hi Sir, I also found problems with options section in:
/classes/utils.php
Primarily with buildAnalyticsOptions functions
There is also a problem with empty $options, since json_encode() returns empty brackets [] instead of empty value
Also you are replacing wrong quotes, we should care about single quotes, since double quotes are treated well with json_encode
The text was updated successfully, but these errors were encountered: