PluginProbe
Include Matomo Tracking, by Jonas Hellmann / 1.1
Include Matomo Tracking, by Jonas Hellmann v1.1
trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.5.1 1.5.2
← All changes | include-matomo.php +19 -31 trunk1.1 View file →
@@ -1,13 +1,12 @@
1 1 <?php
2 2 /*
3 -Plugin Name: Include Matomo Tracking, by Jonas Hellmann
3 +Plugin Name: Include Matomo
4 4 Plugin URI: https://github.com/jonashellmann/include-matomo/
5 5 Description: This plugin includes Matomo into your Wordpress site
6 -Version: 1.5.2
6 +Version: 1.1
7 7 Author: Jonas Hellmann
8 8 Author URI: https://jonas-hellmann.de/en/
9 -Text Domain: include-matomo
10 9 License: GPL3
11 10 */
12 11
13 12 if( get_option('matomo_url') !== '' && get_option('matomo_site_id') !== '0' ) {
@@ -23,11 +22,8 @@
23 22 echo " (function() {\n";
24 23 echo " var u='//" . get_matomo_url() . "/';\n";
25 24 echo " _paq.push(['setTrackerUrl', u+'piwik.php']);\n";
26 25 echo " _paq.push(['setSiteId', '" . get_option('matomo_site_id') . "']);\n";
27 - if (get_option('matomo_disable_cookies', 'n') == 'y') {
28 - echo " _paq.push(['disableCookies']);\n";
29 - }
30 26 echo " var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];\n";
31 27 echo " g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);\n";
32 28 echo " })();\n";
33 29 echo "</script>\n";
@@ -53,10 +49,10 @@
53 49
54 50 function add_matomo_campaign_to_rss($guid) {
55 51 global $post;
56 52 $get_vars = array(
57 - 'pk_campaign=' . urlencode( get_option('matomo_rss_campaign') ),
58 - 'pk_source=' . urlencode( get_option('matomo_rss_source') )
53 + urlencode( 'pk_campaign=' . get_option('matomo_rss_campaign') ),
54 + urlencode( 'pk_source=' . get_option('matomo_rss_source') )
59 55 );
60 56 return $guid . '?' . implode( '&', $get_vars );
61 57 }
62 58
@@ -73,51 +69,43 @@
73 69 register_setting( 'include-matomo-settings-group', 'matomo_url' );
74 70 register_setting( 'include-matomo-settings-group', 'matomo_site_id' );
75 71 register_setting( 'include-matomo-settings-group', 'matomo_rss_campaign' );
76 72 register_setting( 'include-matomo-settings-group', 'matomo_rss_source' );
77 - register_setting( 'include-matomo-settings-group', 'matomo_disable_cookies' );
78 73 }
79 74
80 75 function include_matomo_settings_page() { ?>
81 76 <div class="wrap">
82 - <h2><?php _e('Matomo Settings', 'include-matomo'); ?></h2>
77 + <h2>Matomo Settings</h2>
83 78
84 79 <form method="post" action="options.php">
85 80 <?php settings_fields( 'include-matomo-settings-group' ); ?>
86 - <?php do_settings_sections( 'include-matomo-settings-group' ); ?>
81 + <?php do_settings_sections( 'include-matomo-settings-group' ); ?>
87 82 <table class="form-table">
88 - <tr valign="top">
89 - <th scope="row">Matomo URL</th>
90 - <td>
91 - <input type="text" name="matomo_url" value="<?php echo esc_attr( get_option('matomo_url') ); ?>" />
92 - </td>
93 - </tr>
83 + <tr valign="top">
84 + <th scope="row">Matomo URL</th>
85 + <td>
86 + <input type="text" name="matomo_url" value="<?php echo esc_attr( get_option('matomo_url') ); ?>" />
87 + </td>
88 + </tr>
94 89
95 90 <tr valign="top">
96 - <th scope="row"><?php _e('Matomo Page ID', 'include-matomo' ); ?></th>
91 + <th scope="row">Matomo Page ID</th>
97 92 <td>
98 - <input type="number" name="matomo_site_id" value="<?php echo esc_attr( get_option('matomo_site_id') ); ?>" />
93 + <input type="number" name="matomo_site_id" value="<?php echo esc_attr( get_option('matomo_site_id') ); ?>" />
99 94 </td>
100 95 </tr>
101 96
102 97 <tr valign="top">
103 - <th scope="row"><?php _e('Matomo RSS Campaign', 'include-matomo' );?></th>
98 + <th scope="row">Matomo RSS Campaign</th>
104 99 <td>
105 - <input type="text" name="matomo_rss_campaign" value="<?php echo esc_attr( get_option('matomo_rss_campaign') ); ?>" />
100 + <input type="text" name="matomo_rss_campaign" value="<?php echo esc_attr( get_option('matomo_rss_campaign') ); ?>" />
106 101 </td>
107 102 </tr>
108 103
109 - <tr valign="top">
110 - <th scope="row"><?php _e( 'Matomo RSS Source', 'include-matomo' ); ?></th>
104 + <tr valign="top">
105 + <th scope="row">Matomo RSS Source</th>
111 106 <td>
112 - <input type="text" name="matomo_rss_source" value="<?php echo esc_attr( get_option('matomo_rss_source') ); ?>" />
113 - </td>
114 - </tr>
115 -
116 - <tr valign="top">
117 - <th scope="row"><?php _e( 'Matomo Disable Cookies? (y/n)', 'include-matomo' ); ?></th>
118 - <td>
119 - <input type="text" name="matomo_disable_cookies" value="<?php echo esc_attr( get_option('matomo_disable_cookies', 'n') ); ?>" />
107 + <input type="text" name="matomo_rss_source" value="<?php echo esc_attr( get_option('matomo_rss_source') ); ?>" />
120 108 </td>
121 109 </tr>
122 110 </table>
123 111