Version Description
Download this release
Release Info
| Developer | cavemonkey50 |
| Plugin | |
| Version | 2.2 |
| Comparing to | |
| See all releases | |
Code changes from version 2.14 to 2.2
- google-analyticator.php +49 -5
- readme.txt +5 -2
google-analyticator.php
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
* Plugin Name: Google Analyticator
|
| 4 |
-
* Version: 2.
|
| 5 |
* Plugin URI: http://cavemonkey50.com/code/google-analyticator/
|
| 6 |
* Description: Adds the necessary JavaScript code to enable <a href="http://www.google.com/analytics/">Google's Analytics</a>. After enabling this plugin visit <a href="options-general.php?page=google-analyticator.php">the options page</a> and enter your Google Analytics' UID and enable logging.
|
| 7 |
* Author: Ronald Heft, Jr.
|
|
@@ -22,6 +22,7 @@ define("key_ga_extra_after", "ga_extra_after", true);
|
|
| 22 |
define("key_ga_outbound", "ga_outbound", true);
|
| 23 |
define("key_ga_downloads", "ga_downloads", true);
|
| 24 |
define("key_ga_footer", "ga_footer", true);
|
|
|
|
| 25 |
|
| 26 |
define("ga_uid_default", "XX-XXXXX-X", true);
|
| 27 |
define("ga_status_default", ga_disabled, true);
|
|
@@ -32,6 +33,7 @@ define("ga_extra_after_default", "", true);
|
|
| 32 |
define("ga_outbound_default", ga_enabled, true);
|
| 33 |
define("ga_downloads_default", "", true);
|
| 34 |
define("ga_footer_default", ga_disabled, true);
|
|
|
|
| 35 |
|
| 36 |
// Create the default key and status
|
| 37 |
add_option(key_ga_status, ga_status_default, 'If Google Analytics logging in turned on or off.');
|
|
@@ -43,6 +45,7 @@ add_option(key_ga_extra_after, ga_extra_after_default, 'Addition Google Analytic
|
|
| 43 |
add_option(key_ga_outbound, ga_outbound_default, 'Add tracking of outbound links');
|
| 44 |
add_option(key_ga_downloads, ga_downloads_default, 'Download extensions to track with Google Analyticator');
|
| 45 |
add_option(key_ga_footer, ga_footer_default, 'If Google Analyticator is outputting in the footer');
|
|
|
|
| 46 |
|
| 47 |
// Create a option page for settings
|
| 48 |
add_action('admin_menu', 'add_ga_option_page');
|
|
@@ -113,6 +116,12 @@ function ga_options_page() {
|
|
| 113 |
if (($ga_footer != ga_enabled) && ($ga_footer != ga_disabled))
|
| 114 |
$ga_footer = ga_footer_default;
|
| 115 |
update_option(key_ga_footer, $ga_footer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
// Give an updated message
|
| 118 |
echo "<div class='updated fade'><p><strong>Google Analyticator settings saved.</strong></p></div>";
|
|
@@ -316,6 +325,34 @@ function ga_options_page() {
|
|
| 316 |
<p style="margin: 5px 10px;">Enter any additional lines of tracking code that you would like to include in the Google Analytics tracking script. The code in this section will be displayed <strong>after</strong> the Google Analytics tracker is initialized. Read <a href="http://www.google.com/analytics/InstallingGATrackingCode.pdf">Google Analytics tracker manual</a> to learn what code goes here and how to use it.</p>
|
| 317 |
</td>
|
| 318 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
</table>
|
| 320 |
<p class="submit">
|
| 321 |
<input type='submit' name='info_update' value='Save Changes' />
|
|
@@ -347,10 +384,17 @@ function add_google_analytics() {
|
|
| 347 |
if ((get_option(key_ga_admin) == ga_enabled) || ((get_option(key_ga_admin) == ga_disabled) && ( !current_user_can('level_' . get_option(key_ga_admin_level)) ))) {
|
| 348 |
|
| 349 |
echo "<!-- Google Analytics Tracking by Google Analyticator: http://cavemonkey50.com/code/google-analyticator/ -->\n";
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
|
| 355 |
echo " <script type=\"text/javascript\">\n";
|
| 356 |
echo " var pageTracker = _gat._getTracker(\"$uid\");\n";
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
* Plugin Name: Google Analyticator
|
| 4 |
+
* Version: 2.2
|
| 5 |
* Plugin URI: http://cavemonkey50.com/code/google-analyticator/
|
| 6 |
* Description: Adds the necessary JavaScript code to enable <a href="http://www.google.com/analytics/">Google's Analytics</a>. After enabling this plugin visit <a href="options-general.php?page=google-analyticator.php">the options page</a> and enter your Google Analytics' UID and enable logging.
|
| 7 |
* Author: Ronald Heft, Jr.
|
| 22 |
define("key_ga_outbound", "ga_outbound", true);
|
| 23 |
define("key_ga_downloads", "ga_downloads", true);
|
| 24 |
define("key_ga_footer", "ga_footer", true);
|
| 25 |
+
define("key_ga_specify_http", "ga_specify_http", true);
|
| 26 |
|
| 27 |
define("ga_uid_default", "XX-XXXXX-X", true);
|
| 28 |
define("ga_status_default", ga_disabled, true);
|
| 33 |
define("ga_outbound_default", ga_enabled, true);
|
| 34 |
define("ga_downloads_default", "", true);
|
| 35 |
define("ga_footer_default", ga_disabled, true);
|
| 36 |
+
define("ga_specify_http_default", "auto", true);
|
| 37 |
|
| 38 |
// Create the default key and status
|
| 39 |
add_option(key_ga_status, ga_status_default, 'If Google Analytics logging in turned on or off.');
|
| 45 |
add_option(key_ga_outbound, ga_outbound_default, 'Add tracking of outbound links');
|
| 46 |
add_option(key_ga_downloads, ga_downloads_default, 'Download extensions to track with Google Analyticator');
|
| 47 |
add_option(key_ga_footer, ga_footer_default, 'If Google Analyticator is outputting in the footer');
|
| 48 |
+
add_option(key_ga_specify_http, ga_specify_http_default, 'Automatically detect the http/https settings');
|
| 49 |
|
| 50 |
// Create a option page for settings
|
| 51 |
add_action('admin_menu', 'add_ga_option_page');
|
| 116 |
if (($ga_footer != ga_enabled) && ($ga_footer != ga_disabled))
|
| 117 |
$ga_footer = ga_footer_default;
|
| 118 |
update_option(key_ga_footer, $ga_footer);
|
| 119 |
+
|
| 120 |
+
// Update the HTTP status
|
| 121 |
+
$ga_specify_http = $_POST[key_ga_specify_http];
|
| 122 |
+
if ( $ga_specify_http == '' )
|
| 123 |
+
$ga_specify_http = 'auto';
|
| 124 |
+
update_option(key_ga_specify_http, $ga_specify_http);
|
| 125 |
|
| 126 |
// Give an updated message
|
| 127 |
echo "<div class='updated fade'><p><strong>Google Analyticator settings saved.</strong></p></div>";
|
| 325 |
<p style="margin: 5px 10px;">Enter any additional lines of tracking code that you would like to include in the Google Analytics tracking script. The code in this section will be displayed <strong>after</strong> the Google Analytics tracker is initialized. Read <a href="http://www.google.com/analytics/InstallingGATrackingCode.pdf">Google Analytics tracker manual</a> to learn what code goes here and how to use it.</p>
|
| 326 |
</td>
|
| 327 |
</tr>
|
| 328 |
+
<tr>
|
| 329 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
| 330 |
+
<label for="<?php echo key_ga_specify_http; ?>">Specify HTTP detection:</label>
|
| 331 |
+
</th>
|
| 332 |
+
<td>
|
| 333 |
+
<?php
|
| 334 |
+
echo "<select name='".key_ga_specify_http."' id='".key_ga_specify_http."'>\n";
|
| 335 |
+
|
| 336 |
+
echo "<option value='auto'";
|
| 337 |
+
if(get_option(key_ga_specify_http) == 'auto')
|
| 338 |
+
echo " selected='selected'";
|
| 339 |
+
echo ">Auto Detect</option>\n";
|
| 340 |
+
|
| 341 |
+
echo "<option value='http'";
|
| 342 |
+
if(get_option(key_ga_specify_http) == 'http')
|
| 343 |
+
echo " selected='selected'";
|
| 344 |
+
echo ">HTTP</option>\n";
|
| 345 |
+
|
| 346 |
+
echo "<option value='https'";
|
| 347 |
+
if(get_option(key_ga_specify_http) == 'https')
|
| 348 |
+
echo " selected='selected'";
|
| 349 |
+
echo ">HTTPS</option>\n";
|
| 350 |
+
|
| 351 |
+
echo "</select>\n";
|
| 352 |
+
?>
|
| 353 |
+
<p style="margin: 5px 10px;">Explicitly set the type of HTTP connection your website uses. Setting this option instead of relying on the auto detect may resolve the _gat is undefined error message.</p>
|
| 354 |
+
</td>
|
| 355 |
+
</tr>
|
| 356 |
</table>
|
| 357 |
<p class="submit">
|
| 358 |
<input type='submit' name='info_update' value='Save Changes' />
|
| 384 |
if ((get_option(key_ga_admin) == ga_enabled) || ((get_option(key_ga_admin) == ga_disabled) && ( !current_user_can('level_' . get_option(key_ga_admin_level)) ))) {
|
| 385 |
|
| 386 |
echo "<!-- Google Analytics Tracking by Google Analyticator: http://cavemonkey50.com/code/google-analyticator/ -->\n";
|
| 387 |
+
// Pick the HTTP connection
|
| 388 |
+
if ( get_option(key_ga_specify_http) == 'http' ) {
|
| 389 |
+
echo " <script type=\"text/javascript\" src=\"http://www.google-analytics.com/ga.js\"></script>\n\n";
|
| 390 |
+
} elseif ( get_option(key_ga_specify_http) == 'https' ) {
|
| 391 |
+
echo " <script type=\"text/javascript\" src=\"https://ssl.google-analytics.com/ga.js\"></script>\n\n";
|
| 392 |
+
} else {
|
| 393 |
+
echo " <script type=\"text/javascript\">\n";
|
| 394 |
+
echo " var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n";
|
| 395 |
+
echo " document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n";
|
| 396 |
+
echo " </script>\n\n";
|
| 397 |
+
}
|
| 398 |
|
| 399 |
echo " <script type=\"text/javascript\">\n";
|
| 400 |
echo " var pageTracker = _gat._getTracker(\"$uid\");\n";
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: http://cavemonkey50.com/code/
|
|
| 4 |
Tags: stats, google, analytics, tracking
|
| 5 |
Requires at least: 2.3
|
| 6 |
Tested up to: 2.6
|
| 7 |
-
Stable tag: 2.
|
| 8 |
|
| 9 |
Adds the necessary JavaScript code to enable Google Analytics.
|
| 10 |
|
|
@@ -55,9 +55,12 @@ Google's servers are slow at crawling for the tracking code. While the code may
|
|
| 55 |
|
| 56 |
== Changelog ==
|
| 57 |
|
|
|
|
|
|
|
|
|
|
| 58 |
**2.14** - Bug Fix
|
| 59 |
- Stops the external link tracking code from appearing in feeds, breaking feed validation.
|
| 60 |
-
- Adds compatibility for a very rare few users who
|
| 61 |
|
| 62 |
**2.13** - Bug Fix
|
| 63 |
- Stops the external link tracking code from appearing in feeds, breaking feed validation.
|
| 4 |
Tags: stats, google, analytics, tracking
|
| 5 |
Requires at least: 2.3
|
| 6 |
Tested up to: 2.6
|
| 7 |
+
Stable tag: 2.2
|
| 8 |
|
| 9 |
Adds the necessary JavaScript code to enable Google Analytics.
|
| 10 |
|
| 55 |
|
| 56 |
== Changelog ==
|
| 57 |
|
| 58 |
+
**2.2** - Minor Update
|
| 59 |
+
- Adds an option to specify the GA script location instead of relying on Google's auto detect code. This may resolve the _gat is undefined errors.
|
| 60 |
+
|
| 61 |
**2.14** - Bug Fix
|
| 62 |
- Stops the external link tracking code from appearing in feeds, breaking feed validation.
|
| 63 |
+
- Adds compatibility for a very rare few users who could not save options.
|
| 64 |
|
| 65 |
**2.13** - Bug Fix
|
| 66 |
- Stops the external link tracking code from appearing in feeds, breaking feed validation.
|
