Version Description
Download this release
Release Info
Developer | JeromeMeyer62 |
Plugin | Simple Google Analytics |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.1.0
- readme.txt +7 -3
- simple_google_analytics.php +26 -11
readme.txt
CHANGED
@@ -4,9 +4,9 @@ Contributors: JeromeMeyer62
|
|
4 |
Tags: google analytics, wordpress statistics, tracking
|
5 |
Plugin link: http://www.arobase62.fr/2011/03/23/simple-google-analytics/
|
6 |
Requires at least: 2.6
|
7 |
-
Tested up to: 3.1
|
8 |
-
Version: 1.0
|
9 |
-
Stable tag: 1.0
|
10 |
|
11 |
== Description ==
|
12 |
Simple Google Analytics allows you to easilly add your Google Analytics code on all your pages.
|
@@ -47,6 +47,10 @@ It should work from 2.6 upwards.. Has been tested on all current versions and is
|
|
47 |
1. Screenshot Simple Google Analytics Admin Page
|
48 |
|
49 |
== Changelog ==
|
|
|
|
|
|
|
|
|
50 |
= version 1.0.3 =
|
51 |
* Clean Readme file and clean code
|
52 |
= version 1.0.2 =
|
4 |
Tags: google analytics, wordpress statistics, tracking
|
5 |
Plugin link: http://www.arobase62.fr/2011/03/23/simple-google-analytics/
|
6 |
Requires at least: 2.6
|
7 |
+
Tested up to: 3.1.2
|
8 |
+
Version: 1.1.0
|
9 |
+
Stable tag: 1.1.0
|
10 |
|
11 |
== Description ==
|
12 |
Simple Google Analytics allows you to easilly add your Google Analytics code on all your pages.
|
47 |
1. Screenshot Simple Google Analytics Admin Page
|
48 |
|
49 |
== Changelog ==
|
50 |
+
= version 1.1.0 =
|
51 |
+
* Added new Site Speed setting from Google
|
52 |
+
= version 1.0.4 =
|
53 |
+
* Corriged a bug if you use the Papercite plugin
|
54 |
= version 1.0.3 =
|
55 |
* Clean Readme file and clean code
|
56 |
= version 1.0.2 =
|
simple_google_analytics.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Simple Google Analytics
|
4 |
Plugin URI: http://www.arobase62.fr/2011/03/23/simple-google-analytics/
|
5 |
Description: A simple Plugin to add Analytics code on your pages. You simply enter your ID, you choose if you are on a sub-domain and add your domain name.
|
6 |
-
Version: 1.0
|
7 |
Author: Jerome Meyer
|
8 |
Author URI: http://www.arobase62.fr
|
9 |
*/
|
@@ -13,7 +13,7 @@ Author URI: http://www.arobase62.fr
|
|
13 |
// On lance la traduction
|
14 |
add_action('init', 'launch_i18n') ;
|
15 |
|
16 |
-
// On lance la fonction 'sga_menu' lorsque le menu est
|
17 |
add_action('admin_menu', 'sga_menu') ;
|
18 |
|
19 |
|
@@ -23,22 +23,23 @@ Author URI: http://www.arobase62.fr
|
|
23 |
load_plugin_textdomain('simple_google_analytics', false, $lngPath) ;
|
24 |
}
|
25 |
|
26 |
-
// Ajoute un sous-menu aux
|
27 |
function sga_menu() {
|
28 |
-
//
|
29 |
add_options_page('Simple Google Analytics', 'Simple Google Analytics Settings', 'administrator', __FILE__, 'sga_settings') ;
|
30 |
-
// On lance la fonction au moment
|
31 |
add_action( 'admin_init', 'SGA_register_mysettings') ;
|
32 |
}
|
33 |
|
34 |
-
// On enregistre les
|
35 |
function SGA_register_mysettings() {
|
36 |
register_setting('sga-settings-group', 'analytics_id') ;
|
|
|
37 |
register_setting('sga-settings-group', 'multidomain_setting') ;
|
38 |
register_setting('sga-settings-group', 'multidomain_domain') ;
|
39 |
}
|
40 |
|
41 |
-
// Affichage de la page de
|
42 |
function sga_settings() {
|
43 |
|
44 |
?>
|
@@ -86,6 +87,15 @@ Author URI: http://www.arobase62.fr
|
|
86 |
<input type="text" name="analytics_id" value="<?php echo get_option('analytics_id'); ?>"> <?php _e('Example : UA-0000000-0.', 'simple_google_analytics') ; ?>
|
87 |
</td>
|
88 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
<tr>
|
90 |
<th scope="row" style="text-align:right;" valign="top"><?php _e('Is your blog a sub-domain ? (Google Analytics Setting)', 'simple_google_analytics') ; ?></th>
|
91 |
<td>
|
@@ -132,20 +142,25 @@ Author URI: http://www.arobase62.fr
|
|
132 |
<?php
|
133 |
}
|
134 |
|
135 |
-
// Action
|
136 |
add_action('wp_footer', 'sga_function');
|
137 |
|
138 |
-
// Le texte
|
139 |
function sga_function() {
|
140 |
-
// Seulement si l'utilisateur n'est pas
|
141 |
if ( !is_user_logged_in() ) { ?>
|
142 |
|
143 |
<script type="text/javascript">
|
144 |
|
145 |
var _gaq = _gaq || [];
|
146 |
_gaq.push(['_setAccount', "<?php echo get_option('analytics_id'); ?>"]);
|
|
|
147 |
<?php if (get_option('multidomain_setting') == 1) { ?>
|
148 |
-
|
|
|
|
|
|
|
|
|
149 |
<?php } ?>
|
150 |
_gaq.push(['_trackPageview']);
|
151 |
|
3 |
Plugin Name: Simple Google Analytics
|
4 |
Plugin URI: http://www.arobase62.fr/2011/03/23/simple-google-analytics/
|
5 |
Description: A simple Plugin to add Analytics code on your pages. You simply enter your ID, you choose if you are on a sub-domain and add your domain name.
|
6 |
+
Version: 1.0.4
|
7 |
Author: Jerome Meyer
|
8 |
Author URI: http://www.arobase62.fr
|
9 |
*/
|
13 |
// On lance la traduction
|
14 |
add_action('init', 'launch_i18n') ;
|
15 |
|
16 |
+
// On lance la fonction 'sga_menu' lorsque le menu est charge
|
17 |
add_action('admin_menu', 'sga_menu') ;
|
18 |
|
19 |
|
23 |
load_plugin_textdomain('simple_google_analytics', false, $lngPath) ;
|
24 |
}
|
25 |
|
26 |
+
// Ajoute un sous-menu aux reglages
|
27 |
function sga_menu() {
|
28 |
+
// Genere le lien vers la page de configuration, seulement pour les administrateurs, et lance la fonction 'sga_settings' une fois le menu charge
|
29 |
add_options_page('Simple Google Analytics', 'Simple Google Analytics Settings', 'administrator', __FILE__, 'sga_settings') ;
|
30 |
+
// On lance la fonction au moment ou l'on accede a la zone d'admin
|
31 |
add_action( 'admin_init', 'SGA_register_mysettings') ;
|
32 |
}
|
33 |
|
34 |
+
// On enregistre les parametres specifiques au plugin
|
35 |
function SGA_register_mysettings() {
|
36 |
register_setting('sga-settings-group', 'analytics_id') ;
|
37 |
+
register_setting('sga-settings-group', 'sitespeed_setting') ;
|
38 |
register_setting('sga-settings-group', 'multidomain_setting') ;
|
39 |
register_setting('sga-settings-group', 'multidomain_domain') ;
|
40 |
}
|
41 |
|
42 |
+
// Affichage de la page de parametres
|
43 |
function sga_settings() {
|
44 |
|
45 |
?>
|
87 |
<input type="text" name="analytics_id" value="<?php echo get_option('analytics_id'); ?>"> <?php _e('Example : UA-0000000-0.', 'simple_google_analytics') ; ?>
|
88 |
</td>
|
89 |
</tr>
|
90 |
+
<tr>
|
91 |
+
<th scope="row" style="text-align:right;" valign="top"><?php _e('Add Site Speed to the tracking code ?', 'simple_google_analytics') ; ?></th>
|
92 |
+
<td>
|
93 |
+
<select id="sitespeed" name="sitespeed_setting">
|
94 |
+
<option value="0" <?php selected(get_option('sitespeed_setting'), 0) ; ?>><?php _e('No', 'simple_google_analytics') ; ?></option>
|
95 |
+
<option value="1" <?php selected(get_option('sitespeed_setting'), 1) ; ?>><?php _e('Yes', 'simple_google_analytics') ; ?></option>
|
96 |
+
</select>
|
97 |
+
</td>
|
98 |
+
</tr>
|
99 |
<tr>
|
100 |
<th scope="row" style="text-align:right;" valign="top"><?php _e('Is your blog a sub-domain ? (Google Analytics Setting)', 'simple_google_analytics') ; ?></th>
|
101 |
<td>
|
142 |
<?php
|
143 |
}
|
144 |
|
145 |
+
// Action a lancer lorsque l'on affiche le footer de chaque page
|
146 |
add_action('wp_footer', 'sga_function');
|
147 |
|
148 |
+
// Le texte a rajouter dans le footer
|
149 |
function sga_function() {
|
150 |
+
// Seulement si l'utilisateur n'est pas logge !
|
151 |
if ( !is_user_logged_in() ) { ?>
|
152 |
|
153 |
<script type="text/javascript">
|
154 |
|
155 |
var _gaq = _gaq || [];
|
156 |
_gaq.push(['_setAccount', "<?php echo get_option('analytics_id'); ?>"]);
|
157 |
+
|
158 |
<?php if (get_option('multidomain_setting') == 1) { ?>
|
159 |
+
_gaq.push(['_setDomainName', "<?php echo get_option('multidomain_domain'); ?>"]);
|
160 |
+
<?php } ?>
|
161 |
+
|
162 |
+
<?php if (get_option('sitespeed_setting') == 1) { ?>
|
163 |
+
_gaq.push(['_trackPageLoadTime']);
|
164 |
<?php } ?>
|
165 |
_gaq.push(['_trackPageview']);
|
166 |
|