Version Description
Download this release
Release Info
Developer | matomoteam |
Plugin | Matomo Analytics – Ethical Stats. Powerful Insights. |
Version | 1.3.1 |
Comparing to | |
See all releases |
Code changes from version 1.3.0 to 1.3.1
- app/plugins/CoreHome/templates/_donate.twig +20 -51
- app/plugins/TagManager/Template/Tag/MatomoTag.web.js +2 -4
- assets/js/asset_manager_core_js.js +1 -1
- assets/js/opt-out-configurator.directive.html +9 -0
- assets/js/opt-out-configurator.directive.js +43 -0
- classes/WpMatomo/Admin/SystemReport.php +59 -5
- classes/WpMatomo/Admin/TrackingSettings/Forms.php +11 -2
- classes/WpMatomo/Admin/views/advanced_settings.php +1 -1
- classes/WpMatomo/Admin/views/info.php +4 -1
- classes/WpMatomo/Admin/views/tracking.php +31 -30
- classes/WpMatomo/AjaxTracker.php +13 -1
- classes/WpMatomo/Email.php +1 -0
- classes/WpMatomo/Logger.php +22 -1
- classes/WpMatomo/TrackingCode.php +5 -5
- classes/WpMatomo/TrackingCode/TrackingCodeGenerator.php +5 -3
- classes/WpMatomo/User/Sync.php +6 -1
- matomo.php +4 -2
- plugins/WordPress/WpAssetManager.php +7 -0
- readme.txt +1 -1
app/plugins/CoreHome/templates/_donate.twig
CHANGED
@@ -1,58 +1,27 @@
|
|
1 |
-
<div class="piwik-donate-call">
|
2 |
<div class="piwik-donate-message">
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
<p>{{ 'CoreHome_DonateCall1'|translate }}</p>
|
7 |
-
<p><strong>{{ 'CoreHome_DonateCall2'|translate }}</strong></p>
|
8 |
-
<p>{{ 'CoreHome_DonateCall3'|translate('<strong>','</strong>', '<a target="_blank" rel="nofollow" href="https://matomo.org/recommends/premium-plugins/"><strong>', '</strong></a>')|raw }}</p>
|
9 |
-
{% endif %}
|
10 |
</div>
|
11 |
|
12 |
-
<span id="piwik-worth">
|
13 |
|
14 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
<
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
<div style="display:inline-block;float:right;">
|
22 |
-
<div class="slider-donate-amount">$30/{{ 'Intl_Year_Short'|translate }}</div>
|
23 |
|
24 |
-
|
25 |
-
</div>
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
<div class="donate-submit">
|
31 |
-
<input type="image" src="plugins/Morpheus/images/paypal_subscribe.png" border="0" name="submit"
|
32 |
-
title="{{ 'CoreHome_SubscribeAndBecomePiwikSupporter'|translate }}"/>
|
33 |
-
<a class="donate-spacer">{{ 'CoreHome_MakeOneTimeDonation'|translate }}</a>
|
34 |
-
<a href="index.php?module=CoreHome&action=redirectToPaypal&idSite=1&onetime=true"
|
35 |
-
rel="noreferrer noopener" target="_blank" class="donate-one-time">{{ 'CoreHome_MakeOneTimeDonation'|translate }}</a>
|
36 |
-
</div>
|
37 |
-
|
38 |
-
<!-- to cache images -->
|
39 |
-
<img style="display:none;" src="plugins/Morpheus/images/smileyprog_0.png"/>
|
40 |
-
<img style="display:none;" src="plugins/Morpheus/images/smileyprog_1.png"/>
|
41 |
-
<img style="display:none;" src="plugins/Morpheus/images/smileyprog_2.png"/>
|
42 |
-
<img style="display:none;" src="plugins/Morpheus/images/smileyprog_3.png"/>
|
43 |
-
<img style="display:none;" src="plugins/Morpheus/images/smileyprog_4.png"/>
|
44 |
-
</form>
|
45 |
-
{% if footerMessage is defined %}
|
46 |
-
<div class="form-description">
|
47 |
-
{{ footerMessage }}
|
48 |
-
</div>
|
49 |
-
{% endif %}
|
50 |
-
</div>
|
51 |
-
<script type="text/javascript">
|
52 |
-
$(document).ready(function () {
|
53 |
-
// Note: this will cause problems if more than one donate form is on the page
|
54 |
-
$('.piwik-donate-slider').each(function () {
|
55 |
-
$(this).trigger('piwik:changePosition', {position: 1});
|
56 |
-
});
|
57 |
-
});
|
58 |
-
</script>
|
1 |
+
<div class="piwik-donate-call ng-scope">
|
2 |
<div class="piwik-donate-message">
|
3 |
+
<p>Matomo will always cost you nothing to use, but that doesn't mean it costs us nothing to make.</p>
|
4 |
+
<p><strong>Matomo needs your continued support to grow and thrive.</strong></p>
|
5 |
+
<p>If you feel that Matomo has added significant value to your business or endeavour, <strong>please consider donating</strong> or <a target="_blank" rel="nofollow" href="https://matomo.org/recommends/premium-plugins/"><strong>purchasing a premium feature</strong></a>. Every penny will help.</p>
|
|
|
|
|
|
|
|
|
6 |
</div>
|
7 |
|
8 |
+
<span id="piwik-worth" style="margin: 1em 1em 0.5em 0;">Find us on</span>
|
9 |
|
10 |
+
<ul class="browser-default">
|
11 |
+
<li style="list-style-type: disc;margin-left: 15px;"><a href="https://www.patreon.com/matomo" target="_blank" rel="noreferrer noopener">Patreon</a></li>
|
12 |
+
<li style="list-style-type: disc;margin-left: 15px;"><a href="https://ko-fi.com/matomo" target="_blank" rel="noreferrer noopener">Ko-fi</a></li>
|
13 |
+
<li style="list-style-type: disc;margin-left: 15px;"><a href="https://liberapay.com/Matomo" target="_blank" rel="noreferrer noopener">Liberapay</a></li>
|
14 |
+
<li style="list-style-type: disc;margin-left: 15px;"><a href="https://opencollective.com/matomo-analytics" target="_blank" rel="noreferrer noopener">Open Collective</a></li>
|
15 |
+
<li style="list-style-type: disc;margin-left: 15px;"><a href="https://www.paypal.com/donate/?cmd=_s-xclick&hosted_button_id=RPL23NJURMTFA" target="_blank" rel="noreferrer noopener">PayPal</a></li>
|
16 |
+
</ul>
|
17 |
|
18 |
+
<p style="margin-top: 1em;">
|
19 |
+
Your donation will directly help fund new features and improvements for this open-source analytics platform. This means the community will always benefit from a tool that protects privacy and lets you stay in control of your data.
|
20 |
+
<br><br>
|
21 |
+
<strong>Thank you from all of us at Matomo!</strong>
|
22 |
+
</p>
|
|
|
|
|
23 |
|
24 |
+
<div class="form-description">
|
|
|
25 |
|
26 |
+
</div>
|
27 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/plugins/TagManager/Template/Tag/MatomoTag.web.js
CHANGED
@@ -111,9 +111,9 @@
|
|
111 |
lastMatomoUrl = getMatomoUrlFromConfig(matomoConfig);
|
112 |
var trackerUrl = lastMatomoUrl + matomoConfig.trackingEndpoint;
|
113 |
if (matomoConfig.registerAsDefaultTracker) {
|
114 |
-
tracker = Piwik.addTracker(trackerUrl);
|
115 |
} else {
|
116 |
-
tracker = Piwik.getTracker(trackerUrl);
|
117 |
}
|
118 |
configuredTrackers[variableName] = tracker;
|
119 |
|
@@ -155,8 +155,6 @@
|
|
155 |
tracker.setDomains(domains);
|
156 |
}
|
157 |
|
158 |
-
tracker.setSiteId(matomoConfig.idSite);
|
159 |
-
|
160 |
if (matomoConfig.alwaysUseSendBeacon) {
|
161 |
tracker.alwaysUseSendBeacon();
|
162 |
}
|
111 |
lastMatomoUrl = getMatomoUrlFromConfig(matomoConfig);
|
112 |
var trackerUrl = lastMatomoUrl + matomoConfig.trackingEndpoint;
|
113 |
if (matomoConfig.registerAsDefaultTracker) {
|
114 |
+
tracker = Piwik.addTracker(trackerUrl, matomoConfig.idSite);
|
115 |
} else {
|
116 |
+
tracker = Piwik.getTracker(trackerUrl, matomoConfig.idSite);
|
117 |
}
|
118 |
configuredTrackers[variableName] = tracker;
|
119 |
|
155 |
tracker.setDomains(domains);
|
156 |
}
|
157 |
|
|
|
|
|
158 |
if (matomoConfig.alwaysUseSendBeacon) {
|
159 |
tracker.alwaysUseSendBeacon();
|
160 |
}
|
assets/js/asset_manager_core_js.js
CHANGED
@@ -3787,7 +3787,7 @@ vm.onUpdate();$scope.$watch('piwikurl',function(val,oldVal){vm.onUpdate();});}})
|
|
3787 |
* @link http://piwik.org
|
3788 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
3789 |
*/
|
3790 |
-
(function(){angular.module('piwikApp').directive('
|
3791 |
return function(scope,element,attrs){};}};}})();
|
3792 |
/*!
|
3793 |
* Piwik - free/libre analytics platform
|
3787 |
* @link http://piwik.org
|
3788 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
3789 |
*/
|
3790 |
+
(function(){angular.module('piwikApp').directive('piwikOptOutCustmizer',piwikOptOutCustomizer);piwikOptOutCustomizer.$inject=['piwik'];function piwikOptOutCustomizer(piwik){var defaults={};return{restrict:'A',scope:{language:'@',piwikurl:'@'},templateUrl:'plugins/PrivacyManager/angularjs/opt-out-customizer/opt-out-customizer.directive.html?cb='+piwik.cacheBuster,controller:'OptOutCustomizerController',controllerAs:'optOutCustomizer',compile:function(element,attrs){for(var index in defaults){if(defaults.hasOwnProperty(index)&&attrs[index]===undefined){attrs[index]=defaults[index];}}
|
3791 |
return function(scope,element,attrs){};}};}})();
|
3792 |
/*!
|
3793 |
* Piwik - free/libre analytics platform
|
assets/js/opt-out-configurator.directive.html
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="optOutCustomizer">
|
2 |
+
<p>
|
3 |
+
Use the short code <code>[matomo_opt_out]</code> to embed the opt out into your website.<br>
|
4 |
+
You can use these short code options:</p>
|
5 |
+
<ul style="margin:20px;">
|
6 |
+
<li style="list-style: disc">language - eg de or en. By default the language is detected automatically based on the user's browser</li>
|
7 |
+
</ul>
|
8 |
+
<p>Example: <code>[matomo_opt_out language=de]</code></p>
|
9 |
+
</div>
|
assets/js/opt-out-configurator.directive.js
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* Matomo - free/libre analytics platform
|
3 |
+
*
|
4 |
+
* @link https://matomo.org
|
5 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Usage:
|
10 |
+
* <div piwik-opt-out-customizer>
|
11 |
+
*/
|
12 |
+
(function () {
|
13 |
+
angular.module('piwikApp').directive('piwikOptOutCustomizer', piwikOptOutCustomizer);
|
14 |
+
|
15 |
+
piwikOptOutCustomizer.$inject = ['piwik'];
|
16 |
+
|
17 |
+
function piwikOptOutCustomizer(piwik){
|
18 |
+
var defaults = {
|
19 |
+
// showAllSitesItem: 'true'
|
20 |
+
};
|
21 |
+
|
22 |
+
return {
|
23 |
+
restrict: 'A',
|
24 |
+
scope: {
|
25 |
+
language: '@',
|
26 |
+
piwikurl: '@'
|
27 |
+
},
|
28 |
+
templateUrl: '../assets/js/opt-out-configurator.directive.html?cb=' + piwik.cacheBuster,
|
29 |
+
compile: function (element, attrs) {
|
30 |
+
|
31 |
+
for (var index in defaults) {
|
32 |
+
if (defaults.hasOwnProperty(index) && attrs[index] === undefined) {
|
33 |
+
attrs[index] = defaults[index];
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
return function (scope, element, attrs) {
|
38 |
+
|
39 |
+
};
|
40 |
+
}
|
41 |
+
};
|
42 |
+
}
|
43 |
+
})();
|
classes/WpMatomo/Admin/SystemReport.php
CHANGED
@@ -9,17 +9,20 @@
|
|
9 |
|
10 |
namespace WpMatomo\Admin;
|
11 |
|
|
|
12 |
use Piwik\CliMulti;
|
13 |
use Piwik\Common;
|
14 |
use Piwik\Config;
|
15 |
use Piwik\Container\StaticContainer;
|
16 |
use Piwik\Date;
|
|
|
17 |
use Piwik\Filesystem;
|
18 |
use Piwik\MetricsFormatter;
|
19 |
use Piwik\Plugins\CoreAdminHome\API;
|
20 |
use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResult;
|
21 |
use Piwik\Plugins\Diagnostics\DiagnosticService;
|
22 |
use Piwik\Plugins\UserCountry\LocationProvider;
|
|
|
23 |
use WpMatomo\Bootstrap;
|
24 |
use WpMatomo\Capabilities;
|
25 |
use WpMatomo\Installer;
|
@@ -199,7 +202,7 @@ class SystemReport {
|
|
199 |
array(
|
200 |
'title' => 'Browser',
|
201 |
'rows' => $this->get_browser_info(),
|
202 |
-
'has_comments' =>
|
203 |
),
|
204 |
);
|
205 |
}
|
@@ -493,6 +496,7 @@ class SystemReport {
|
|
493 |
if ( ! \WpMatomo::is_safe_mode() ) {
|
494 |
Bootstrap::do_bootstrap();
|
495 |
$general = Config::getInstance()->General;
|
|
|
496 |
if (empty($general['proxy_client_headers'])) {
|
497 |
foreach (AdvancedSettings::$valid_host_headers as $header) {
|
498 |
if (!empty($_SERVER[$header])) {
|
@@ -500,7 +504,7 @@ class SystemReport {
|
|
500 |
'name' => 'Proxy header',
|
501 |
'value' => $header,
|
502 |
'is_warning' => true,
|
503 |
-
'comment' => 'A proxy header is set which means you maybe need to configure a proxy header in the Advanced settings to make location reporting work. If the location in your reports is detected correctly, you can ignore this warning.',
|
504 |
);
|
505 |
}
|
506 |
}
|
@@ -610,6 +614,36 @@ class SystemReport {
|
|
610 |
);
|
611 |
}
|
612 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
613 |
return $rows;
|
614 |
}
|
615 |
|
@@ -630,7 +664,7 @@ class SystemReport {
|
|
630 |
|
631 |
try {
|
632 |
$time = gmdate( 'Y-m-d H:i:s', time() - $days_in_seconds );
|
633 |
-
$sql = $wpdb->prepare('SELECT
|
634 |
$row = $wpdb->get_var( $sql );
|
635 |
} catch ( \Exception $e ) {
|
636 |
$row = null;
|
@@ -944,14 +978,34 @@ class SystemReport {
|
|
944 |
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
|
945 |
$rows[] = array(
|
946 |
'name' => 'Browser',
|
947 |
-
'value' =>
|
|
|
948 |
);
|
949 |
}
|
950 |
if (!\WpMatomo::is_safe_mode()) {
|
951 |
Bootstrap::do_bootstrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
952 |
$rows[] = array(
|
953 |
'name' => 'Language',
|
954 |
-
'value' => Common::getBrowserLanguage()
|
|
|
955 |
);
|
956 |
}
|
957 |
|
9 |
|
10 |
namespace WpMatomo\Admin;
|
11 |
|
12 |
+
use DeviceDetector\DeviceDetector;
|
13 |
use Piwik\CliMulti;
|
14 |
use Piwik\Common;
|
15 |
use Piwik\Config;
|
16 |
use Piwik\Container\StaticContainer;
|
17 |
use Piwik\Date;
|
18 |
+
use Piwik\DeviceDetector\DeviceDetectorFactory;
|
19 |
use Piwik\Filesystem;
|
20 |
use Piwik\MetricsFormatter;
|
21 |
use Piwik\Plugins\CoreAdminHome\API;
|
22 |
use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResult;
|
23 |
use Piwik\Plugins\Diagnostics\DiagnosticService;
|
24 |
use Piwik\Plugins\UserCountry\LocationProvider;
|
25 |
+
use Piwik\Tracker\Failures;
|
26 |
use WpMatomo\Bootstrap;
|
27 |
use WpMatomo\Capabilities;
|
28 |
use WpMatomo\Installer;
|
202 |
array(
|
203 |
'title' => 'Browser',
|
204 |
'rows' => $this->get_browser_info(),
|
205 |
+
'has_comments' => true,
|
206 |
),
|
207 |
);
|
208 |
}
|
496 |
if ( ! \WpMatomo::is_safe_mode() ) {
|
497 |
Bootstrap::do_bootstrap();
|
498 |
$general = Config::getInstance()->General;
|
499 |
+
|
500 |
if (empty($general['proxy_client_headers'])) {
|
501 |
foreach (AdvancedSettings::$valid_host_headers as $header) {
|
502 |
if (!empty($_SERVER[$header])) {
|
504 |
'name' => 'Proxy header',
|
505 |
'value' => $header,
|
506 |
'is_warning' => true,
|
507 |
+
'comment' => 'A proxy header is set which means you maybe need to configure a proxy header in the Advanced settings to make location reporting work. If the location in your reports is detected correctly, you can ignore this warning. Learn more: https://matomo.org/faq/wordpress/how-do-i-fix-the-proxy-header-warning-in-the-matomo-for-wordpress-system-report/',
|
508 |
);
|
509 |
}
|
510 |
}
|
614 |
);
|
615 |
}
|
616 |
|
617 |
+
|
618 |
+
if ( ! \WpMatomo::is_safe_mode() ) {
|
619 |
+
Bootstrap::do_bootstrap();
|
620 |
+
$trackfailures = [];
|
621 |
+
try {
|
622 |
+
$tracking_failures = new Failures();
|
623 |
+
$trackfailures = $tracking_failures->getAllFailures();
|
624 |
+
} catch (\Exception $e) {
|
625 |
+
// ignored in case not set up yet etc.
|
626 |
+
}
|
627 |
+
if (!empty($trackfailures)) {
|
628 |
+
$rows[] = array(
|
629 |
+
'section' => 'Tracking failures',
|
630 |
+
);
|
631 |
+
foreach ($trackfailures as $failure) {
|
632 |
+
$comment = sprintf('Solution: %s<br>More info: %s<br>Date: %s<br>Request URL: %s',
|
633 |
+
$failure['solution'], $failure['solution_url'],
|
634 |
+
$failure['pretty_date_first_occurred'], $failure['request_url']);
|
635 |
+
$rows[] = array(
|
636 |
+
'name' => $failure['problem'],
|
637 |
+
'is_warning' => true,
|
638 |
+
'value' => '',
|
639 |
+
'comment' => $comment,
|
640 |
+
);
|
641 |
+
}
|
642 |
+
|
643 |
+
}
|
644 |
+
}
|
645 |
+
|
646 |
+
|
647 |
return $rows;
|
648 |
}
|
649 |
|
664 |
|
665 |
try {
|
666 |
$time = gmdate( 'Y-m-d H:i:s', time() - $days_in_seconds );
|
667 |
+
$sql = $wpdb->prepare('SELECT idsite from ' . $prefix_table . ' where visit_last_action_time > %s LIMIT 1', $time );
|
668 |
$row = $wpdb->get_var( $sql );
|
669 |
} catch ( \Exception $e ) {
|
670 |
$row = null;
|
978 |
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
|
979 |
$rows[] = array(
|
980 |
'name' => 'Browser',
|
981 |
+
'value' => '',
|
982 |
+
'comment' => $_SERVER['HTTP_USER_AGENT']
|
983 |
);
|
984 |
}
|
985 |
if (!\WpMatomo::is_safe_mode()) {
|
986 |
Bootstrap::do_bootstrap();
|
987 |
+
try {
|
988 |
+
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
|
989 |
+
$detector = StaticContainer::get(DeviceDetectorFactory::class)->makeInstance($_SERVER['HTTP_USER_AGENT']);
|
990 |
+
$client = $detector->getClient();
|
991 |
+
if (!empty($client['name']) && $client['name'] === 'Microsoft Edge' && (int) $client['version'] >= 85) {
|
992 |
+
$rows[] = array(
|
993 |
+
'name' => 'Browser Compatibility',
|
994 |
+
'is_warning' => true,
|
995 |
+
'value' => 'Yes',
|
996 |
+
'comment' => 'Because you are using MS Edge browser, you may see a warning like "This site has been reported as unsafe" from "Microsoft Defender SmartScreen" when you view the Matomo Reporting, Admin or Tag Manager page. This is a false alert and you can safely ignore this warning by clicking on the icon next to the URL (in the address bar) and choosing either "Report as safe" (preferred) or "Show unsafe content". We are hoping to get this false warning removed in the future.'
|
997 |
+
);
|
998 |
+
}
|
999 |
+
}
|
1000 |
+
|
1001 |
+
} catch (\Exception $e) {
|
1002 |
+
|
1003 |
+
}
|
1004 |
+
|
1005 |
$rows[] = array(
|
1006 |
'name' => 'Language',
|
1007 |
+
'value' => Common::getBrowserLanguage(),
|
1008 |
+
'comment' => ''
|
1009 |
);
|
1010 |
}
|
1011 |
|
classes/WpMatomo/Admin/TrackingSettings/Forms.php
CHANGED
@@ -90,8 +90,17 @@ class Forms {
|
|
90 |
*
|
91 |
* @param string $text Text to show
|
92 |
*/
|
93 |
-
public function show_text( $text ) {
|
94 |
-
printf( '<tr><td colspan="2"><p>%s</p></td></tr>', esc_html( $text ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
96 |
|
97 |
/**
|
90 |
*
|
91 |
* @param string $text Text to show
|
92 |
*/
|
93 |
+
public function show_text( $text , $group_name = '' ) {
|
94 |
+
printf( '<tr class="%s"><td colspan="2"><p>%s</p></td></tr>', $group_name, esc_html( $text ) );
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Show a simple text
|
99 |
+
*
|
100 |
+
* @param string $text Text to show
|
101 |
+
*/
|
102 |
+
public function show_headline( $text , $group_name = '') {
|
103 |
+
printf( '<tr class="%s"><td colspan="2"><h3>%s</h3></td></tr>', $group_name, esc_html( $text ) );
|
104 |
}
|
105 |
|
106 |
/**
|
classes/WpMatomo/Admin/views/advanced_settings.php
CHANGED
@@ -39,7 +39,7 @@ if ( $was_updated ) {
|
|
39 |
<?php
|
40 |
echo '<span style="white-space: nowrap;display: inline-block;"><input type="radio" ' . ( empty($matomo_client_headers) ? 'checked="checked" ' : '' ) . ' value="REMOTE_ADDR" name="matomo[proxy_client_header]" /> <code>REMOTE_ADDR</code> ' . ( ! empty( $_SERVER[ 'REMOTE_ADDR' ] ) ? esc_html( $_SERVER[ 'REMOTE_ADDR' ] ) : esc_html__( 'No value found', 'matomo' ) ) . ' (' . esc_html__( 'Default', 'matomo' ) .')</span>';
|
41 |
foreach ( AdvancedSettings::$valid_host_headers as $host_header ) {
|
42 |
-
echo '<span style="white-space: nowrap;display: inline-block;"><input type="radio" ' . ( in_array( $host_header, $matomo_client_headers, true ) ? 'checked="checked" ' : '' ) . 'value="'. esc_attr($host_header).'" name="matomo[proxy_client_header]" /> <code>' . $host_header . '</code> ' . ( ! empty( $_SERVER[ $host_header ] ) ? esc_html( $_SERVER[ $host_header ] ) : esc_html__( 'No value found', 'matomo' ) ) . ' </span>';
|
43 |
}
|
44 |
?>
|
45 |
</td>
|
39 |
<?php
|
40 |
echo '<span style="white-space: nowrap;display: inline-block;"><input type="radio" ' . ( empty($matomo_client_headers) ? 'checked="checked" ' : '' ) . ' value="REMOTE_ADDR" name="matomo[proxy_client_header]" /> <code>REMOTE_ADDR</code> ' . ( ! empty( $_SERVER[ 'REMOTE_ADDR' ] ) ? esc_html( $_SERVER[ 'REMOTE_ADDR' ] ) : esc_html__( 'No value found', 'matomo' ) ) . ' (' . esc_html__( 'Default', 'matomo' ) .')</span>';
|
41 |
foreach ( AdvancedSettings::$valid_host_headers as $host_header ) {
|
42 |
+
echo '<span style="white-space: nowrap;display: inline-block;"><input type="radio" ' . ( in_array( $host_header, $matomo_client_headers, true ) ? 'checked="checked" ' : '' ) . 'value="'. esc_attr($host_header).'" name="matomo[proxy_client_header]" /> <code>' . $host_header . '</code> ' . ( ! empty( $_SERVER[ $host_header ] ) ? ('<strong>'. esc_html( $_SERVER[ $host_header ] ) . '</strong>') : esc_html__( 'No value found', 'matomo' ) ) . ' </span>';
|
43 |
}
|
44 |
?>
|
45 |
</td>
|
classes/WpMatomo/Admin/views/info.php
CHANGED
@@ -40,7 +40,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
40 |
);
|
41 |
?>
|
42 |
<br/><br/>
|
43 |
-
|
|
|
|
|
44 |
echo sprintf(
|
45 |
esc_html__(
|
46 |
'You can also help us by %1$sdonating%2$s or by %3$spurchasing premium plugins%4$s which fund the
|
@@ -53,6 +55,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
53 |
'</a>'
|
54 |
);
|
55 |
?>
|
|
|
56 |
</p>
|
57 |
|
58 |
<?php require 'info_newsletter.php'; ?>
|
40 |
);
|
41 |
?>
|
42 |
<br/><br/>
|
43 |
+
Matomo will always cost you nothing to use, but that doesn't mean it costs us nothing to make.
|
44 |
+
Matomo needs your continued support to grow and thrive.
|
45 |
+
<?php
|
46 |
echo sprintf(
|
47 |
esc_html__(
|
48 |
'You can also help us by %1$sdonating%2$s or by %3$spurchasing premium plugins%4$s which fund the
|
55 |
'</a>'
|
56 |
);
|
57 |
?>
|
58 |
+
Every penny will help.
|
59 |
</p>
|
60 |
|
61 |
<?php require 'info_newsletter.php'; ?>
|
classes/WpMatomo/Admin/views/tracking.php
CHANGED
@@ -82,38 +82,10 @@ if ( $was_updated ) {
|
|
82 |
'matomo-track-option matomo-track-option-default matomo-track-option-tagmanager matomo-track-option-manually'
|
83 |
);
|
84 |
|
85 |
-
$matomo_form->show_textarea( 'noscript_code', esc_html__( 'Noscript code', 'matomo' ), 2, 'This is a preview of your <noscript> code which is part of your tracking code.', $matomo_is_not_tracking, 'matomo-track-option matomo-track-option-default matomo-track-option-manually', true, '', ( $settings->get_global_option( 'track_mode' ) !== 'manually' ), false );
|
86 |
-
|
87 |
-
$matomo_form->show_checkbox( 'track_noscript', __( 'Add <noscript>', 'matomo' ), __( 'Adds the <noscript> code to your footer.', 'matomo' ), $matomo_is_not_tracking, 'matomo-track-option matomo-track-option-default matomo-track-option-manually' );
|
88 |
-
|
89 |
-
$matomo_form->show_select(
|
90 |
-
'track_api_endpoint',
|
91 |
-
__( 'Endpoint for HTTP Tracking API', 'matomo' ),
|
92 |
-
array(
|
93 |
-
'default' => esc_html__( 'Default', 'matomo' ),
|
94 |
-
'restapi' => esc_html__( 'Through WordPress Rest API', 'matomo' ),
|
95 |
-
),
|
96 |
-
__( 'By default the HTTP Tracking API points to your Matomo plugin directory "' . esc_html( $matomo_paths->get_tracker_api_url_in_matomo_dir() ) . '". You can choose to use the WP Rest API (' . esc_html( $matomo_paths->get_tracker_api_rest_api_endpoint() ) . ') instead for example to hide matomo.php or if the other URL doesn\'t work for you. Note: If the tracking mode "Tag Manager" is selected, then this URL currently only applies to the feed tracking.', 'matomo' ),
|
97 |
-
'',
|
98 |
-
$matomo_is_not_tracking,
|
99 |
-
$matomo_full_generated_tracking_group . ' matomo-track-option-manually matomo-track-option-tagmanager'
|
100 |
-
);
|
101 |
-
|
102 |
-
$matomo_form->show_select(
|
103 |
-
'track_js_endpoint',
|
104 |
-
__( 'Endpoint for JavaScript tracker', 'matomo' ),
|
105 |
-
array(
|
106 |
-
'default' => esc_html__( 'Default', 'matomo' ),
|
107 |
-
'restapi' => esc_html__( 'Through WordPress Rest API (slower)', 'matomo' ),
|
108 |
-
),
|
109 |
-
__( 'By default the JS tracking code will be loaded from "' . esc_html( $matomo_paths->get_js_tracker_url_in_matomo_dir() ) . '". You can choose to serve the JS file through the WP Rest API (' . esc_html( $matomo_paths->get_js_tracker_rest_api_endpoint() ) . ') for example to hide matomo.js. Please note that this means every request to the JavaScript file will launch WordPress PHP and therefore will be slower compared to your webserver serving the JS file directly.', 'matomo' ),
|
110 |
-
'',
|
111 |
-
$matomo_is_not_tracking,
|
112 |
-
$matomo_full_generated_tracking_group
|
113 |
-
);
|
114 |
-
|
115 |
$matomo_form->show_select( \WpMatomo\Settings::SITE_CURRENCY, esc_html__( 'Currency', 'matomo' ), $matomo_currencies, esc_html__('Choose the currency which will be used in reports.', 'matomo'), '' );
|
116 |
|
|
|
|
|
117 |
$matomo_form->show_checkbox( 'disable_cookies', esc_html__( 'Disable cookies', 'matomo' ), esc_html__( 'Disable all tracking cookies for a visitor.', 'matomo' ), $matomo_is_not_generated_tracking, $matomo_full_generated_tracking_group );
|
118 |
|
119 |
$matomo_form->show_checkbox( 'track_ecommerce', esc_html__( 'Enable ecommerce', 'matomo' ), esc_html__( 'Matom can track Ecommerce orders, abandoned carts and product views for WooCommerce, Easy Digital Analytics, MemberPress, and more. Disabling this feature will also remove Ecommerce reports from the Matomo UI.', 'matomo' ), $matomo_is_not_tracking, $matomo_full_generated_tracking_group . ' matomo-track-option-manually matomo-track-option-tagmanager' );
|
@@ -198,6 +170,10 @@ if ( $was_updated ) {
|
|
198 |
|
199 |
$matomo_form->show_input( 'set_link_classes', esc_html__( 'Set classes to be treated as outlinks', 'matomo' ), esc_html__( 'Set classes to be treated as outlinks (in addition to piwik_link), divided by a vertical bar (|). Leave blank to keep Matomo\'s default settings.', 'matomo' ) . ' ' . sprintf( esc_html__( 'See %1$sMatomo JavaScript Tracking Client reference%2$s.', 'matomo' ), '<a href="https://developer.matomo.org/api-reference/tracking-javascript" target="_BLANK">', '</a>' ), $matomo_is_not_tracking, $matomo_full_generated_tracking_group );
|
200 |
|
|
|
|
|
|
|
|
|
201 |
$matomo_form->show_select(
|
202 |
'force_protocol',
|
203 |
__( 'Force Matomo to use a specific protocol', 'matomo' ),
|
@@ -210,6 +186,31 @@ if ( $was_updated ) {
|
|
210 |
$matomo_is_not_tracking,
|
211 |
$matomo_full_generated_tracking_group . ' matomo-track-option-tagmanager'
|
212 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
|
214 |
echo $matomo_submit_button;
|
215 |
?>
|
82 |
'matomo-track-option matomo-track-option-default matomo-track-option-tagmanager matomo-track-option-manually'
|
83 |
);
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
$matomo_form->show_select( \WpMatomo\Settings::SITE_CURRENCY, esc_html__( 'Currency', 'matomo' ), $matomo_currencies, esc_html__('Choose the currency which will be used in reports.', 'matomo'), '' );
|
86 |
|
87 |
+
$matomo_form->show_headline(esc_html__('Customise tracking (optional)', 'matomo'), 'matomo-track-option matomo-track-option-default matomo-track-option-manually matomo-track-option-tagmanager');
|
88 |
+
|
89 |
$matomo_form->show_checkbox( 'disable_cookies', esc_html__( 'Disable cookies', 'matomo' ), esc_html__( 'Disable all tracking cookies for a visitor.', 'matomo' ), $matomo_is_not_generated_tracking, $matomo_full_generated_tracking_group );
|
90 |
|
91 |
$matomo_form->show_checkbox( 'track_ecommerce', esc_html__( 'Enable ecommerce', 'matomo' ), esc_html__( 'Matom can track Ecommerce orders, abandoned carts and product views for WooCommerce, Easy Digital Analytics, MemberPress, and more. Disabling this feature will also remove Ecommerce reports from the Matomo UI.', 'matomo' ), $matomo_is_not_tracking, $matomo_full_generated_tracking_group . ' matomo-track-option-manually matomo-track-option-tagmanager' );
|
170 |
|
171 |
$matomo_form->show_input( 'set_link_classes', esc_html__( 'Set classes to be treated as outlinks', 'matomo' ), esc_html__( 'Set classes to be treated as outlinks (in addition to piwik_link), divided by a vertical bar (|). Leave blank to keep Matomo\'s default settings.', 'matomo' ) . ' ' . sprintf( esc_html__( 'See %1$sMatomo JavaScript Tracking Client reference%2$s.', 'matomo' ), '<a href="https://developer.matomo.org/api-reference/tracking-javascript" target="_BLANK">', '</a>' ), $matomo_is_not_tracking, $matomo_full_generated_tracking_group );
|
172 |
|
173 |
+
$matomo_form->show_textarea( 'noscript_code', esc_html__( 'Noscript code', 'matomo' ), 2, 'This is a preview of your <noscript> code which is part of your tracking code. Will only show if the noscript feature is enabled.', $matomo_is_not_tracking, 'matomo-track-option matomo-track-option-default matomo-track-option-manually', true, '', ( $settings->get_global_option( 'track_mode' ) !== 'manually' ), false );
|
174 |
+
|
175 |
+
$matomo_form->show_checkbox( 'track_noscript', __( 'Add <noscript>', 'matomo' ), __( 'Adds the <noscript> code to your footer.', 'matomo' ) . ' This can be useful if you have a lot of visitors that have JavaScript disabled.', $matomo_is_not_tracking, 'matomo-track-option matomo-track-option-default matomo-track-option-manually' );
|
176 |
+
|
177 |
$matomo_form->show_select(
|
178 |
'force_protocol',
|
179 |
__( 'Force Matomo to use a specific protocol', 'matomo' ),
|
186 |
$matomo_is_not_tracking,
|
187 |
$matomo_full_generated_tracking_group . ' matomo-track-option-tagmanager'
|
188 |
);
|
189 |
+
$matomo_form->show_select(
|
190 |
+
'track_api_endpoint',
|
191 |
+
__( 'Endpoint for HTTP Tracking API', 'matomo' ),
|
192 |
+
array(
|
193 |
+
'default' => esc_html__( 'Default', 'matomo' ),
|
194 |
+
'restapi' => esc_html__( 'Through WordPress Rest API', 'matomo' ),
|
195 |
+
),
|
196 |
+
__( 'By default the HTTP Tracking API points to your Matomo plugin directory "' . esc_html( $matomo_paths->get_tracker_api_url_in_matomo_dir() ) . '". You can choose to use the WP Rest API (' . esc_html( $matomo_paths->get_tracker_api_rest_api_endpoint() ) . ') instead for example to hide matomo.php or if the other URL doesn\'t work for you. Note: If the tracking mode "Tag Manager" is selected, then this URL currently only applies to the feed tracking.', 'matomo' ),
|
197 |
+
'',
|
198 |
+
$matomo_is_not_tracking,
|
199 |
+
$matomo_full_generated_tracking_group . ' matomo-track-option-manually matomo-track-option-tagmanager'
|
200 |
+
);
|
201 |
+
|
202 |
+
$matomo_form->show_select(
|
203 |
+
'track_js_endpoint',
|
204 |
+
__( 'Endpoint for JavaScript tracker', 'matomo' ),
|
205 |
+
array(
|
206 |
+
'default' => esc_html__( 'Default', 'matomo' ),
|
207 |
+
'restapi' => esc_html__( 'Through WordPress Rest API (slower)', 'matomo' ),
|
208 |
+
),
|
209 |
+
__( 'By default the JS tracking code will be loaded from "' . esc_html( $matomo_paths->get_js_tracker_url_in_matomo_dir() ) . '". You can choose to serve the JS file through the WP Rest API (' . esc_html( $matomo_paths->get_js_tracker_rest_api_endpoint() ) . ') for example to hide matomo.js. Please note that this means every request to the JavaScript file will launch WordPress PHP and therefore will be slower compared to your webserver serving the JS file directly.', 'matomo' ),
|
210 |
+
'',
|
211 |
+
$matomo_is_not_tracking,
|
212 |
+
$matomo_full_generated_tracking_group
|
213 |
+
);
|
214 |
|
215 |
echo $matomo_submit_button;
|
216 |
?>
|
classes/WpMatomo/AjaxTracker.php
CHANGED
@@ -9,6 +9,8 @@
|
|
9 |
|
10 |
namespace WpMatomo;
|
11 |
|
|
|
|
|
12 |
if ( ! defined( 'ABSPATH' ) ) {
|
13 |
exit; // if accessed directly
|
14 |
}
|
@@ -19,8 +21,11 @@ if ( ! class_exists( '\PiwikTracker' ) ) {
|
|
19 |
|
20 |
class AjaxTracker extends \PiwikTracker {
|
21 |
private $has_cookie = false;
|
|
|
22 |
|
23 |
public function __construct( Settings $settings ) {
|
|
|
|
|
24 |
$site = new Site();
|
25 |
$idsite = $site->get_current_matomo_site_id();
|
26 |
|
@@ -65,6 +70,7 @@ class AjaxTracker extends \PiwikTracker {
|
|
65 |
|
66 |
protected function sendRequest( $url, $method = 'GET', $data = null, $force = false ) {
|
67 |
if ( ! $this->idSite ) {
|
|
|
68 |
return; // not installed or synced yet
|
69 |
}
|
70 |
$args = array(
|
@@ -79,7 +85,13 @@ class AjaxTracker extends \PiwikTracker {
|
|
79 |
// 1) Not send any response no matter what happens
|
80 |
// 2) Never exit at any point
|
81 |
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
}
|
84 |
|
85 |
}
|
9 |
|
10 |
namespace WpMatomo;
|
11 |
|
12 |
+
use WpMatomo\Logger;
|
13 |
+
|
14 |
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
exit; // if accessed directly
|
16 |
}
|
21 |
|
22 |
class AjaxTracker extends \PiwikTracker {
|
23 |
private $has_cookie = false;
|
24 |
+
private $logger;
|
25 |
|
26 |
public function __construct( Settings $settings ) {
|
27 |
+
$this->logger = new Logger();
|
28 |
+
|
29 |
$site = new Site();
|
30 |
$idsite = $site->get_current_matomo_site_id();
|
31 |
|
70 |
|
71 |
protected function sendRequest( $url, $method = 'GET', $data = null, $force = false ) {
|
72 |
if ( ! $this->idSite ) {
|
73 |
+
$this->logger->log('ecommerce tracking could not find idSite, cannot send request');
|
74 |
return; // not installed or synced yet
|
75 |
}
|
76 |
$args = array(
|
85 |
// 1) Not send any response no matter what happens
|
86 |
// 2) Never exit at any point
|
87 |
|
88 |
+
$response = wp_remote_request( $url, $args );
|
89 |
+
|
90 |
+
if (is_wp_error($response)) {
|
91 |
+
$this->logger->log_exception('ajax_tracker', new \Exception($response->get_error_message()));
|
92 |
+
}
|
93 |
+
|
94 |
+
return $response;
|
95 |
}
|
96 |
|
97 |
}
|
classes/WpMatomo/Email.php
CHANGED
@@ -115,6 +115,7 @@ class Email extends \Zend_Mail_Transport_Abstract {
|
|
115 |
|
116 |
$this->rememberMailSent();
|
117 |
|
|
|
118 |
$success = wp_mail( $recipients, $subject, $content, $header );
|
119 |
|
120 |
remove_action( 'wp_mail_failed', array($this, 'onError') );
|
115 |
|
116 |
$this->rememberMailSent();
|
117 |
|
118 |
+
$header = trim($header);
|
119 |
$success = wp_mail( $recipients, $subject, $content, $header );
|
120 |
|
121 |
remove_action( 'wp_mail_failed', array($this, 'onError') );
|
classes/WpMatomo/Logger.php
CHANGED
@@ -16,8 +16,29 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
16 |
}
|
17 |
|
18 |
class Logger {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
public function log( $message ) {
|
21 |
if ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) {
|
22 |
if ( is_array( $message ) || is_object( $message ) ) {
|
23 |
error_log( 'Matomo: ' . print_r( $message, true ) );
|
16 |
}
|
17 |
|
18 |
class Logger {
|
19 |
+
const LEVEL_NONE = 99;
|
20 |
+
const LEVEL_DEBUG = 1;
|
21 |
+
const LEVEL_INFO = 3;
|
22 |
+
|
23 |
+
private function get_log_level()
|
24 |
+
{
|
25 |
+
if ( defined('MATOMO_DEBUG')) {
|
26 |
+
if (MATOMO_DEBUG) {
|
27 |
+
return self::LEVEL_DEBUG;
|
28 |
+
}
|
29 |
+
return self::LEVEL_NONE;
|
30 |
+
}
|
31 |
+
|
32 |
+
return self::LEVEL_INFO;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function log( $message , $mode = 3) {
|
36 |
+
$log_level = $this->get_log_level();
|
37 |
+
|
38 |
+
if ($log_level > $mode) {
|
39 |
+
return;
|
40 |
+
}
|
41 |
|
|
|
42 |
if ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) {
|
43 |
if ( is_array( $message ) || is_object( $message ) ) {
|
44 |
error_log( 'Matomo: ' . print_r( $message, true ) );
|
classes/WpMatomo/TrackingCode.php
CHANGED
@@ -90,14 +90,14 @@ class TrackingCode {
|
|
90 |
*/
|
91 |
public function add_javascript_code() {
|
92 |
if ( $this->is_hidden_user() ) {
|
93 |
-
$this->logger->log( 'Do not add tracking code to site (user should not be tracked) Blog ID: ' . get_current_blog_id() );
|
94 |
|
95 |
return;
|
96 |
}
|
97 |
|
98 |
$tracking_code = $this->generator->get_tracking_code();
|
99 |
|
100 |
-
$this->logger->log( 'Add tracking code. Blog ID: ' . get_current_blog_id() );
|
101 |
|
102 |
if ( $this->settings->is_network_enabled()
|
103 |
&& 'manually' === $this->settings->get_global_option( 'track_mode' ) ) {
|
@@ -120,7 +120,7 @@ class TrackingCode {
|
|
120 |
*/
|
121 |
public function add_noscript_code() {
|
122 |
if ( $this->is_hidden_user() ) {
|
123 |
-
$this->logger->log( 'Do not add noscript code to site (user should not be tracked) Blog ID: ' . get_current_blog_id() );
|
124 |
|
125 |
return;
|
126 |
}
|
@@ -128,10 +128,10 @@ class TrackingCode {
|
|
128 |
$code = $this->generator->get_noscript_code();
|
129 |
|
130 |
if ( ! empty( $code ) ) {
|
131 |
-
$this->logger->log( 'Add noscript code. Blog ID: ' . get_current_blog_id() );
|
132 |
echo $code . "\n";
|
133 |
} else {
|
134 |
-
$this->logger->log( 'No noscript code present. Blog ID: ' . get_current_blog_id() );
|
135 |
}
|
136 |
}
|
137 |
|
90 |
*/
|
91 |
public function add_javascript_code() {
|
92 |
if ( $this->is_hidden_user() ) {
|
93 |
+
$this->logger->log( 'Do not add tracking code to site (user should not be tracked) Blog ID: ' . get_current_blog_id(), Logger::LEVEL_DEBUG );
|
94 |
|
95 |
return;
|
96 |
}
|
97 |
|
98 |
$tracking_code = $this->generator->get_tracking_code();
|
99 |
|
100 |
+
$this->logger->log( 'Add tracking code. Blog ID: ' . get_current_blog_id(), Logger::LEVEL_DEBUG );
|
101 |
|
102 |
if ( $this->settings->is_network_enabled()
|
103 |
&& 'manually' === $this->settings->get_global_option( 'track_mode' ) ) {
|
120 |
*/
|
121 |
public function add_noscript_code() {
|
122 |
if ( $this->is_hidden_user() ) {
|
123 |
+
$this->logger->log( 'Do not add noscript code to site (user should not be tracked) Blog ID: ' . get_current_blog_id(), Logger::LEVEL_DEBUG );
|
124 |
|
125 |
return;
|
126 |
}
|
128 |
$code = $this->generator->get_noscript_code();
|
129 |
|
130 |
if ( ! empty( $code ) ) {
|
131 |
+
$this->logger->log( 'Add noscript code. Blog ID: ' . get_current_blog_id(), Logger::LEVEL_DEBUG );
|
132 |
echo $code . "\n";
|
133 |
} else {
|
134 |
+
$this->logger->log( 'No noscript code present. Blog ID: ' . get_current_blog_id(), Logger::LEVEL_DEBUG );
|
135 |
}
|
136 |
}
|
137 |
|
classes/WpMatomo/TrackingCode/TrackingCodeGenerator.php
CHANGED
@@ -211,7 +211,9 @@ g.type=\'text/javascript\'; g.async=true; g.src="' . $container_url . '"; s.pare
|
|
211 |
* @return array
|
212 |
*/
|
213 |
public function prepare_tracking_code( $idsite ) {
|
214 |
-
$
|
|
|
|
|
215 |
|
216 |
$tracker_endpoint = $this->get_tracker_endpoint();
|
217 |
$js_endpoint = $this->get_js_endpoint();
|
@@ -298,8 +300,8 @@ g.type='text/javascript'; g.async=true; g.src=" . wp_json_encode( $js_endpoint )
|
|
298 |
$script = apply_filters( 'matomo_tracking_code_script', $script, $idsite );
|
299 |
$script = apply_filters( 'matomo_tracking_code_noscript', $script, $idsite );
|
300 |
|
301 |
-
$this->logger->log( 'Finished tracking code: ' . $script );
|
302 |
-
$this->logger->log( 'Finished noscript code: ' . $no_script );
|
303 |
|
304 |
return array(
|
305 |
'script' => $script,
|
211 |
* @return array
|
212 |
*/
|
213 |
public function prepare_tracking_code( $idsite ) {
|
214 |
+
$logLevel = is_admin() ? Logger::LEVEL_DEBUG : Logger::LEVEL_INFO;
|
215 |
+
|
216 |
+
$this->logger->log( 'Apply tracking code changes:', $logLevel );
|
217 |
|
218 |
$tracker_endpoint = $this->get_tracker_endpoint();
|
219 |
$js_endpoint = $this->get_js_endpoint();
|
300 |
$script = apply_filters( 'matomo_tracking_code_script', $script, $idsite );
|
301 |
$script = apply_filters( 'matomo_tracking_code_noscript', $script, $idsite );
|
302 |
|
303 |
+
$this->logger->log( 'Finished tracking code: ' . $script, $logLevel );
|
304 |
+
$this->logger->log( 'Finished noscript code: ' . $no_script, $logLevel);
|
305 |
|
306 |
return array(
|
307 |
'script' => $script,
|
classes/WpMatomo/User/Sync.php
CHANGED
@@ -169,7 +169,12 @@ class Sync {
|
|
169 |
|
170 |
if ( $matomo_login ) {
|
171 |
$locale = get_user_locale( $user->ID );
|
172 |
-
$
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
if ( ! empty( $parts[0] ) ) {
|
175 |
$lang = $parts[0];
|
169 |
|
170 |
if ( $matomo_login ) {
|
171 |
$locale = get_user_locale( $user->ID );
|
172 |
+
$locale_dash = Common::mb_strtolower(str_replace('_', '-', $locale));
|
173 |
+
if ($locale && in_array($locale_dash, ['zh-cn', 'zh-tw', 'pt-br', 'es-ar'], true)) {
|
174 |
+
$parts = [$locale_dash];
|
175 |
+
} else {
|
176 |
+
$parts = explode( '_', $locale );
|
177 |
+
}
|
178 |
|
179 |
if ( ! empty( $parts[0] ) ) {
|
180 |
$lang = $parts[0];
|
matomo.php
CHANGED
@@ -4,10 +4,10 @@
|
|
4 |
* Description: The #1 Google Analytics alternative that gives you full control over your data and protects the privacy for your users. Free, secure and open.
|
5 |
* Author: Matomo
|
6 |
* Author URI: https://matomo.org
|
7 |
-
* Version: 1.3.
|
8 |
* Domain Path: /languages
|
9 |
* WC requires at least: 2.4.0
|
10 |
-
* WC tested up to: 4.
|
11 |
*
|
12 |
* Matomo - free/libre analytics platform
|
13 |
*
|
@@ -126,7 +126,9 @@ function matomo_anonymize_value( $value ) {
|
|
126 |
$values_to_anonymize = array(
|
127 |
ABSPATH => '$ABSPATH/',
|
128 |
str_replace( '/', '\/', ABSPATH ) => '$ABSPATH\/',
|
|
|
129 |
WP_CONTENT_DIR => '$WP_CONTENT_DIR/',
|
|
|
130 |
home_url() => '$home_url',
|
131 |
site_url() => '$site_url',
|
132 |
DB_PASSWORD => '$DB_PASSWORD',
|
4 |
* Description: The #1 Google Analytics alternative that gives you full control over your data and protects the privacy for your users. Free, secure and open.
|
5 |
* Author: Matomo
|
6 |
* Author URI: https://matomo.org
|
7 |
+
* Version: 1.3.1
|
8 |
* Domain Path: /languages
|
9 |
* WC requires at least: 2.4.0
|
10 |
+
* WC tested up to: 4.6.0
|
11 |
*
|
12 |
* Matomo - free/libre analytics platform
|
13 |
*
|
126 |
$values_to_anonymize = array(
|
127 |
ABSPATH => '$ABSPATH/',
|
128 |
str_replace( '/', '\/', ABSPATH ) => '$ABSPATH\/',
|
129 |
+
str_replace( '/', '\\', ABSPATH ) => '$ABSPATH\/',
|
130 |
WP_CONTENT_DIR => '$WP_CONTENT_DIR/',
|
131 |
+
str_replace( '/', '\\', WP_CONTENT_DIR ) => '$WP_CONTENT_DIR\\',
|
132 |
home_url() => '$home_url',
|
133 |
site_url() => '$site_url',
|
134 |
DB_PASSWORD => '$DB_PASSWORD',
|
plugins/WordPress/WpAssetManager.php
CHANGED
@@ -11,6 +11,7 @@ namespace Piwik\Plugins\WordPress;
|
|
11 |
|
12 |
use Piwik\AssetManager;
|
13 |
use Piwik\Plugins\WordPress\AssetManager\NeverDeleteOnDiskUiAsset;
|
|
|
14 |
use Piwik\Translate;
|
15 |
use Piwik\Version;
|
16 |
|
@@ -58,11 +59,17 @@ class WpAssetManager extends AssetManager
|
|
58 |
|
59 |
foreach ($jsFiles as $jsFile) {
|
60 |
$jQueryPath = includes_url('js/' . $jsFile);
|
|
|
|
|
|
|
|
|
|
|
61 |
$result .= sprintf(self::JS_IMPORT_DIRECTIVE, $jQueryPath);
|
62 |
}
|
63 |
|
64 |
$result .= "<script type=\"text/javascript\">window.$ = jQuery;</script>";
|
65 |
$result .= sprintf(self::JS_IMPORT_DIRECTIVE, '../assets/js/asset_manager_core_js.js?v=' . Version::VERSION);
|
|
|
66 |
|
67 |
// may need to change or allow to this... but how to make the wp-includes relative?
|
68 |
// $result .= sprintf(self::JS_IMPORT_DIRECTIVE, plugins_url( 'assets/js/asset_manager_core_js.js', MATOMO_ANALYTICS_FILE ) . '?v=' . Version::VERSION);
|
11 |
|
12 |
use Piwik\AssetManager;
|
13 |
use Piwik\Plugins\WordPress\AssetManager\NeverDeleteOnDiskUiAsset;
|
14 |
+
use Piwik\ProxyHttp;
|
15 |
use Piwik\Translate;
|
16 |
use Piwik\Version;
|
17 |
|
59 |
|
60 |
foreach ($jsFiles as $jsFile) {
|
61 |
$jQueryPath = includes_url('js/' . $jsFile);
|
62 |
+
if (ProxyHttp::isHttps()) {
|
63 |
+
$jQueryPath = str_replace('http://', 'https://', $jQueryPath);
|
64 |
+
} else {
|
65 |
+
$jQueryPath = str_replace('http://', '//', $jQueryPath);
|
66 |
+
}
|
67 |
$result .= sprintf(self::JS_IMPORT_DIRECTIVE, $jQueryPath);
|
68 |
}
|
69 |
|
70 |
$result .= "<script type=\"text/javascript\">window.$ = jQuery;</script>";
|
71 |
$result .= sprintf(self::JS_IMPORT_DIRECTIVE, '../assets/js/asset_manager_core_js.js?v=' . Version::VERSION);
|
72 |
+
$result .= sprintf(self::JS_IMPORT_DIRECTIVE, '../assets/js/opt-out-configurator.directive.js?v=' . Version::VERSION);
|
73 |
|
74 |
// may need to change or allow to this... but how to make the wp-includes relative?
|
75 |
// $result .= sprintf(self::JS_IMPORT_DIRECTIVE, plugins_url( 'assets/js/asset_manager_core_js.js', MATOMO_ANALYTICS_FILE ) . '?v=' . Version::VERSION);
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: matomo,piwik,analytics,statistics,stats,tracking,ecommerce
|
5 |
Requires at least: 4.8
|
6 |
Tested up to: 5.5
|
7 |
-
Stable tag: 1.3.
|
8 |
Requires PHP: 7.2
|
9 |
License: GPLv3 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
4 |
Tags: matomo,piwik,analytics,statistics,stats,tracking,ecommerce
|
5 |
Requires at least: 4.8
|
6 |
Tested up to: 5.5
|
7 |
+
Stable tag: 1.3.1
|
8 |
Requires PHP: 7.2
|
9 |
License: GPLv3 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|