Version Description
- Fixed:
- Properly track the post type when you're on a post type archive page.
- Remove single quotes from item names for Shopp and WP E-commerce to prevent tracking issues (props Caleb Whitmore).
- Only load the admin class when you're actually in admin and not doing AJAX.
- Prevent notices on post types that do not have categories or tags.
Download this release
Release Info
| Developer | joostdevalk |
| Plugin | |
| Version | 4.0.13 |
| Comparing to | |
| See all releases | |
Code changes from version 4.0.12 to 4.0.13
- googleanalytics.php +30 -20
- readme.txt +9 -1
googleanalytics.php
CHANGED
|
@@ -4,7 +4,7 @@ Plugin Name: Google Analytics for WordPress
|
|
| 4 |
Plugin URI: http://yoast.com/wordpress/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=google-analytics-for-wordpress&utm_content=v407
|
| 5 |
Description: This plugin makes it simple to add Google Analytics to your WordPress blog, adding lots of features, eg. custom variables and automatic clickout and download tracking.
|
| 6 |
Author: Joost de Valk
|
| 7 |
-
Version: 4.0.
|
| 8 |
Requires at least: 2.8
|
| 9 |
Author URI: http://yoast.com/
|
| 10 |
License: GPL
|
|
@@ -12,7 +12,7 @@ License: GPL
|
|
| 12 |
|
| 13 |
// This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics
|
| 14 |
|
| 15 |
-
define('GAWP_VERSION', '4.0.
|
| 16 |
|
| 17 |
// Determine the location
|
| 18 |
function gapp_plugin_path() {
|
|
@@ -23,9 +23,9 @@ function gapp_plugin_path() {
|
|
| 23 |
* Admin User Interface
|
| 24 |
*/
|
| 25 |
|
| 26 |
-
if ( ! class_exists( 'GA_Admin' ) ) {
|
| 27 |
|
| 28 |
-
require_once plugin_dir_path(__FILE__).'yst_plugin_tools.php';
|
| 29 |
|
| 30 |
class GA_Admin extends Yoast_GA_Plugin_Admin {
|
| 31 |
|
|
@@ -858,7 +858,15 @@ if ( ! class_exists( 'GA_Filter' ) ) {
|
|
| 858 |
$customvarslot++;
|
| 859 |
}
|
| 860 |
|
| 861 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 862 |
if ( $options['cv_post_type'] ) {
|
| 863 |
$post_type = get_post_type();
|
| 864 |
if ( $post_type ) {
|
|
@@ -872,30 +880,32 @@ if ( ! class_exists( 'GA_Filter' ) ) {
|
|
| 872 |
}
|
| 873 |
if ( $options['cv_tags'] ) {
|
| 874 |
$i = 0;
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
|
| 878 |
-
$
|
| 879 |
-
|
| 880 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 881 |
}
|
| 882 |
-
// Max 64 chars for value and label combined, hence 64 - 4
|
| 883 |
-
$tagsstr = substr($tagsstr, 0, 60);
|
| 884 |
-
$push[] = "'_setCustomVar',$customvarslot,'tags','".$tagsstr."',3";
|
| 885 |
$customvarslot++;
|
| 886 |
}
|
| 887 |
-
if (
|
| 888 |
if ( $options['cv_year'] ) {
|
| 889 |
$push[] = "'_setCustomVar',$customvarslot,'year','".get_the_time('Y')."',3";
|
| 890 |
$customvarslot++;
|
| 891 |
}
|
| 892 |
-
if ( $options['cv_category'] ) {
|
| 893 |
$cats = get_the_category();
|
| 894 |
if ( is_array( $cats ) && isset( $cats[0] ) )
|
| 895 |
$push[] = "'_setCustomVar',$customvarslot,'category','".$cats[0]->slug."',3";
|
| 896 |
$customvarslot++;
|
| 897 |
}
|
| 898 |
-
if ( $options['cv_all_categories'] ) {
|
| 899 |
$i = 0;
|
| 900 |
$catsstr = '';
|
| 901 |
foreach ( (array) get_the_category() as $cat ) {
|
|
@@ -957,7 +967,7 @@ if ( ! class_exists( 'GA_Filter' ) ) {
|
|
| 957 |
?>
|
| 958 |
|
| 959 |
<script type="text/javascript">//<![CDATA[
|
| 960 |
-
// Google Analytics for WordPress by Yoast v<?php echo
|
| 961 |
var _gaq = _gaq || [];
|
| 962 |
_gaq.push(['_setAccount','<?php echo trim($options["uastring"]); ?>']);
|
| 963 |
<?php
|
|
@@ -1243,7 +1253,7 @@ if ( $options['gajslocalhosting'] && !empty($options['gajsurl']) ) {
|
|
| 1243 |
$push[] = "'_addItem',"
|
| 1244 |
."'".$cart_log_id."'," // Order ID
|
| 1245 |
."'".$item['sku']."'," // Item SKU
|
| 1246 |
-
."'"
|
| 1247 |
."'".$item['category']."'," // Item Category
|
| 1248 |
."'".$item['price']."'," // Item Price
|
| 1249 |
."'".$item['quantity']."'"; // Item Quantity
|
|
@@ -1290,7 +1300,7 @@ if ( $options['gajslocalhosting'] && !empty($options['gajsurl']) ) {
|
|
| 1290 |
$push[] = "'_addItem',"
|
| 1291 |
."'".$Purchase->id."',"
|
| 1292 |
."'".$sku."',"
|
| 1293 |
-
."'"
|
| 1294 |
."'".$item->optionlabel."',"
|
| 1295 |
."'".number_format($item->unitprice,2)."',"
|
| 1296 |
."'".$item->quantity."'";
|
| 4 |
Plugin URI: http://yoast.com/wordpress/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=google-analytics-for-wordpress&utm_content=v407
|
| 5 |
Description: This plugin makes it simple to add Google Analytics to your WordPress blog, adding lots of features, eg. custom variables and automatic clickout and download tracking.
|
| 6 |
Author: Joost de Valk
|
| 7 |
+
Version: 4.0.13
|
| 8 |
Requires at least: 2.8
|
| 9 |
Author URI: http://yoast.com/
|
| 10 |
License: GPL
|
| 12 |
|
| 13 |
// This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics
|
| 14 |
|
| 15 |
+
define('GAWP_VERSION', '4.0.13');
|
| 16 |
|
| 17 |
// Determine the location
|
| 18 |
function gapp_plugin_path() {
|
| 23 |
* Admin User Interface
|
| 24 |
*/
|
| 25 |
|
| 26 |
+
if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) && !class_exists( 'GA_Admin' ) ) {
|
| 27 |
|
| 28 |
+
require_once plugin_dir_path( __FILE__ ) . 'yst_plugin_tools.php';
|
| 29 |
|
| 30 |
class GA_Admin extends Yoast_GA_Plugin_Admin {
|
| 31 |
|
| 858 |
$customvarslot++;
|
| 859 |
}
|
| 860 |
|
| 861 |
+
if ( function_exists('is_post_type_archive') && is_post_type_archive() ) {
|
| 862 |
+
if ( $options['cv_post_type'] ) {
|
| 863 |
+
$post_type = get_post_type();
|
| 864 |
+
if ( $post_type ) {
|
| 865 |
+
$push[] = "'_setCustomVar',".$customvarslot.",'post_type','".$post_type."',3";
|
| 866 |
+
$customvarslot++;
|
| 867 |
+
}
|
| 868 |
+
}
|
| 869 |
+
} else if ( is_singular() && !is_home() ) {
|
| 870 |
if ( $options['cv_post_type'] ) {
|
| 871 |
$post_type = get_post_type();
|
| 872 |
if ( $post_type ) {
|
| 880 |
}
|
| 881 |
if ( $options['cv_tags'] ) {
|
| 882 |
$i = 0;
|
| 883 |
+
if ( get_the_tags() ) {
|
| 884 |
+
$tagsstr = '';
|
| 885 |
+
foreach ( get_the_tags() as $tag ) {
|
| 886 |
+
if ($i > 0)
|
| 887 |
+
$tagsstr .= ' ';
|
| 888 |
+
$tagsstr .= $tag->slug;
|
| 889 |
+
$i++;
|
| 890 |
+
}
|
| 891 |
+
// Max 64 chars for value and label combined, hence 64 - 4
|
| 892 |
+
$tagsstr = substr($tagsstr, 0, 60);
|
| 893 |
+
$push[] = "'_setCustomVar',$customvarslot,'tags','".$tagsstr."',3";
|
| 894 |
}
|
|
|
|
|
|
|
|
|
|
| 895 |
$customvarslot++;
|
| 896 |
}
|
| 897 |
+
if ( is_singular() ) {
|
| 898 |
if ( $options['cv_year'] ) {
|
| 899 |
$push[] = "'_setCustomVar',$customvarslot,'year','".get_the_time('Y')."',3";
|
| 900 |
$customvarslot++;
|
| 901 |
}
|
| 902 |
+
if ( $options['cv_category'] && is_single() ) {
|
| 903 |
$cats = get_the_category();
|
| 904 |
if ( is_array( $cats ) && isset( $cats[0] ) )
|
| 905 |
$push[] = "'_setCustomVar',$customvarslot,'category','".$cats[0]->slug."',3";
|
| 906 |
$customvarslot++;
|
| 907 |
}
|
| 908 |
+
if ( $options['cv_all_categories'] && is_single() ) {
|
| 909 |
$i = 0;
|
| 910 |
$catsstr = '';
|
| 911 |
foreach ( (array) get_the_category() as $cat ) {
|
| 967 |
?>
|
| 968 |
|
| 969 |
<script type="text/javascript">//<![CDATA[
|
| 970 |
+
// Google Analytics for WordPress by Yoast v<?php echo GAWP_VERSION; ?> | http://yoast.com/wordpress/google-analytics/
|
| 971 |
var _gaq = _gaq || [];
|
| 972 |
_gaq.push(['_setAccount','<?php echo trim($options["uastring"]); ?>']);
|
| 973 |
<?php
|
| 1253 |
$push[] = "'_addItem',"
|
| 1254 |
."'".$cart_log_id."'," // Order ID
|
| 1255 |
."'".$item['sku']."'," // Item SKU
|
| 1256 |
+
."'". str_replace( "'", "", $item['name'] ) ."'," // Item Name
|
| 1257 |
."'".$item['category']."'," // Item Category
|
| 1258 |
."'".$item['price']."'," // Item Price
|
| 1259 |
."'".$item['quantity']."'"; // Item Quantity
|
| 1300 |
$push[] = "'_addItem',"
|
| 1301 |
."'".$Purchase->id."',"
|
| 1302 |
."'".$sku."',"
|
| 1303 |
+
."'". str_replace( "'", "", $item->name ) ."',"
|
| 1304 |
."'".$item->optionlabel."',"
|
| 1305 |
."'".number_format($item->unitprice,2)."',"
|
| 1306 |
."'".$item->quantity."'";
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: http://yoast.com/donate/
|
|
| 4 |
Tags: analytics, google analytics, statistics, tracking, stats, google
|
| 5 |
Requires at least: 2.8
|
| 6 |
Tested up to: 3.1
|
| 7 |
-
Stable tag: 4.0.
|
| 8 |
|
| 9 |
Track your WordPress site easily and with lots of metadata: views per author & category, automatic tracking of outbound clicks and pageviews.
|
| 10 |
|
|
@@ -60,6 +60,14 @@ This section describes how to install the plugin and get it working.
|
|
| 60 |
|
| 61 |
== Changelog ==
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
= 4.0.12 =
|
| 64 |
|
| 65 |
* Fixed:
|
| 4 |
Tags: analytics, google analytics, statistics, tracking, stats, google
|
| 5 |
Requires at least: 2.8
|
| 6 |
Tested up to: 3.1
|
| 7 |
+
Stable tag: 4.0.13
|
| 8 |
|
| 9 |
Track your WordPress site easily and with lots of metadata: views per author & category, automatic tracking of outbound clicks and pageviews.
|
| 10 |
|
| 60 |
|
| 61 |
== Changelog ==
|
| 62 |
|
| 63 |
+
= 4.0.13 =
|
| 64 |
+
|
| 65 |
+
* Fixed:
|
| 66 |
+
* Properly track the post type when you're on a post type archive page.
|
| 67 |
+
* Remove single quotes from item names for Shopp and WP E-commerce to prevent tracking issues (props [Caleb Whitmore](http://www.analyticspros.com/)).
|
| 68 |
+
* Only load the admin class when you're actually in admin and not doing AJAX.
|
| 69 |
+
* Prevent notices on post types that do not have categories or tags.
|
| 70 |
+
|
| 71 |
= 4.0.12 =
|
| 72 |
|
| 73 |
* Fixed:
|
