Page MenuHomeGitPull.it

No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..a4abe2d
--- /dev/null
+++ b/index.php
@@ -0,0 +1,2 @@
+<?php
+
diff --git a/matomo-reyboz.php b/matomo-reyboz.php
new file mode 100644
index 0000000..a4f738a
--- /dev/null
+++ b/matomo-reyboz.php
@@ -0,0 +1,63 @@
+<?php
+/*
+Plugin Name: Matomo Stats
+Plugin URI: https://matomo.org/
+Description: Absolutely lightweight and secure plugin to use an already existing Matomo instance for your WordPress site and have privacy friendly stats. In short: Google Analytics MERDA. The configuration is inside your WP config file.
+Version: 1.2.0
+Author: Valerio Bozzolan
+Author URI: https://boz.reyboz.it/
+License: GPL3
+License URI: http://www.gnu.org/licenses/gpl.html
+*/
+
+defined( 'MATOMO_PATH' ) or exit;
+defined( 'MATOMO_SITE' ) or die( 'please define MATOMO_PATH and MATOMO_SITE in your wp-config.php');
+
+add_action( 'wp_footer', function () {
+
+ if( isset( $_SERVER['HTTP_DNT'] ) && $_SERVER['HTTP_DNT'] === '1' ) {
+ echo "\n<!-- Hey! You do not want to be tracked (DNT)! Good for you! So no JavaScript tracker for your request! Just this little image... :^) -->\n";
+ echo "<!-- For the records... this pixel is not evil: we already can track you looking in the webserver logs, so do not fight about this pixel :^) -->\n";
+ printf( '<img src="%smatomo.php?idsite=%d&amp;rec=1" style="border:0" alt="" />',
+ MATOMO_PATH,
+ MATOMO_SITE
+ );
+ return;
+ }
+
+ $path = MATOMO_PATH;
+ $site = MATOMO_SITE;
+
+$js = <<<EOF
+ <!-- Matomo -->
+ <script>
+ var _paq = _paq || [];
+ _paq.push(['trackPageView']);
+ _paq.push(['enableLinkTracking']);
+ (function() {
+ var u="$path";
+ _paq.push(['setTrackerUrl', u+'piwik.php']);
+ _paq.push(['setSiteId', '$site']);
+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
+ g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
+ })();
+ </script>
+ <!-- end Matomo -->
+EOF;
+
+ echo $js;
+} );
+
+/*
+ * Register the stat menu link icon
+ */
+add_action( 'admin_menu', function () {
+ add_menu_page( 'Matomo Stats', 'Matomo Stats', 'manage_options', 'view_matomo_stats', 'function', 'dashicons-performance' );
+} );
+
+add_action( 'admin_init', function () {
+ if( isset( $_GET['page'] ) && $_GET['page'] === 'view_matomo_stats' ) {
+ wp_redirect( MATOMO_PATH );
+ exit();
+ }
+}, 1 );

File Metadata

Mime Type
text/x-diff
Expires
Thu, Nov 19, 03:22 (12 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2264361
Default Alt Text
(2 KB)

Event Timeline