Version Description
- 15/08/2014 =
- Added new feature - Product impressions and Product click on category page view , including the default pagination
- Fixed-Allow Special Characters in javascript
Download this release
Release Info
Developer | Tatvic |
Plugin | Enhanced Ecommerce Google Analytics Plugin for WooCommerce |
Version | 1.0.6.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.0.6.1
includes/class-wc-enhanced-ecommerce-google-analytics-integration.php
CHANGED
@@ -9,6 +9,7 @@
|
|
9 |
* @extends WC_Integration
|
10 |
* @author Sudhir Mishra <sudhirxps@gmail.com>
|
11 |
*/
|
|
|
12 |
class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
13 |
|
14 |
/**
|
@@ -20,7 +21,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
20 |
public function __construct() {
|
21 |
$this->id = 'enhanced_ecommerce_google_analytics';
|
22 |
$this->method_title = __('Enhanced Ecommerce Google Analytics', 'woocommerce');
|
23 |
-
$this->method_description = __('Enhanced Ecommerce is a new feature of Universal Analytics that generates detailed statistics about the users journey from product page to thank you page on your e-store. <br/><a href="
|
24 |
|
25 |
// Load the settings.
|
26 |
$this->init_form_fields();
|
@@ -34,7 +35,8 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
34 |
$this->enable_guest_checkout = get_option('woocommerce_enable_guest_checkout') == 'yes' ? true : false;
|
35 |
$this->track_login_step_for_guest_user = $this->get_option('track_login_step_for_guest_user') == 'yes' ? true : false;
|
36 |
$this->ga_enhanced_ecommerce_tracking_enabled = $this->get_option('ga_enhanced_ecommerce_tracking_enabled');
|
37 |
-
|
|
|
38 |
// Actions
|
39 |
add_action('woocommerce_update_options_integration_enhanced_ecommerce_google_analytics', array($this, 'process_admin_options'));
|
40 |
// API Call to LS with e-mail
|
@@ -43,6 +45,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
43 |
add_action('woocommerce_thankyou', array($this, 'ecommerce_tracking_code'));
|
44 |
|
45 |
// Enhanced Ecommerce product impression hook
|
|
|
46 |
add_action('woocommerce_after_shop_loop_item', array($this, 'product_impression'));
|
47 |
add_action('woocommerce_after_single_product', array($this, 'product_detail_view'));
|
48 |
add_action('woocommerce_after_cart', array($this, 'remove_cart_tracking'));
|
@@ -102,6 +105,12 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
102 |
'checkboxgroup' => '',
|
103 |
'description' => sprintf(__('For Guest users Login is not a mandatory step. Checking the box would consider the click event on place order as Login as well as Checkout.', 'woocommerce')),
|
104 |
'default' => get_option('track_login_step_for_guest_user') ? get_option('track_login_step_for_guest_user') : 'no' // Backwards compat
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
)
|
106 |
);
|
107 |
/* When user updates the email, post it to the remote server */
|
@@ -153,11 +162,12 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
153 |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
154 |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
155 |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
156 |
-
|
157 |
ga('create', '" . esc_js($tracking_id) . "', '" . $set_domain_name . "');
|
158 |
ga('require', 'ec', 'ec.js');
|
159 |
</script>";
|
160 |
-
|
|
|
161 |
|
162 |
/**
|
163 |
* Google Analytics eCommerce tracking
|
@@ -192,22 +202,23 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
192 |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
193 |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
194 |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
195 |
-
|
196 |
ga('create', '" . esc_js($tracking_id) . "', '" . $set_domain_name . "');
|
197 |
ga('require', 'ec', 'ec.js');
|
198 |
-
|
199 |
|
200 |
";
|
201 |
-
|
|
|
202 |
// Order items
|
203 |
if ($order->get_items()) {
|
204 |
foreach ($order->get_items() as $item) {
|
205 |
$_product = $order->get_product_from_item($item);
|
206 |
|
207 |
-
$code .= "ga('ec:addProduct', {";
|
208 |
$code .= "'name': '" . esc_js($item['name']) . "',";
|
209 |
-
$code .= "'id': '" . esc_js($_product->get_sku()) . "',";
|
210 |
-
|
211 |
if (isset($_product->variation_data)) {
|
212 |
|
213 |
$code .= "'category': '" . esc_js(woocommerce_get_formatted_variation($_product->variation_data, true)) . "',";
|
@@ -241,6 +252,128 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
241 |
update_post_meta($order_id, '_ga_tracked', 1);
|
242 |
}
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
/**
|
245 |
* Enhanced E-commerce tracking for single product add to cart
|
246 |
*
|
@@ -254,7 +387,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
254 |
|
255 |
if (!is_single())
|
256 |
return;
|
257 |
-
|
258 |
global $product, $woocommerce;
|
259 |
|
260 |
$parameters = array();
|
@@ -315,14 +448,8 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
315 |
if (version_compare($woocommerce->version, '2.1', '>=')) {
|
316 |
|
317 |
wc_enqueue_js("
|
318 |
-
|
319 |
-
|
320 |
-
ga('ec:addImpression',{
|
321 |
-
'id': $(this).parents('li').find('.ls-pro-sku').val(),
|
322 |
-
'name': $(this).parents('li').find('.ls-pro-name').val(),
|
323 |
-
'category': $(this).parents('li').find('.ls-pro-category').val(),
|
324 |
-
'price': $(this).parents('li').find('.ls-pro-price').val(),
|
325 |
-
});
|
326 |
// Enhanced E-commerce Add to cart clicks
|
327 |
ga('ec:addProduct', {
|
328 |
'id': $(this).parents('li').find('.ls-pro-sku').val(),
|
@@ -337,13 +464,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
337 |
} else {
|
338 |
$woocommerce->add_inline_js("
|
339 |
$('.add_to_cart_button:not(.product_type_variable, .product_type_grouped)').click(function() {
|
340 |
-
|
341 |
-
ga('ec:addImpression',{
|
342 |
-
'id': $(this).parents('li').find('.ls-pro-sku').val(),
|
343 |
-
'name': $(this).parents('li').find('.ls-pro-name').val(),
|
344 |
-
'category': $(this).parents('li').find('.ls-pro-category').val(),
|
345 |
-
'price': $(this).parents('li').find('.ls-pro-price').val(),
|
346 |
-
});
|
347 |
// Enhanced E-commerce Add to cart clicks
|
348 |
ga('ec:addProduct', {
|
349 |
'id': $(this).parents('li').find('.ls-pro-sku').val(),
|
@@ -365,6 +486,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
365 |
* @return void
|
366 |
*/
|
367 |
public function product_detail_view() {
|
|
|
368 |
if ($this->disable_tracking($this->ga_enhanced_ecommerce_tracking_enabled)) {
|
369 |
return;
|
370 |
}
|
@@ -419,6 +541,8 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
419 |
foreach ($category as $term) {
|
420 |
$categories.=$term->name . ',';
|
421 |
}
|
|
|
|
|
422 |
|
423 |
echo "<input type='hidden' class='ls-pro-price' value='" . esc_html($product->get_price()) . "'/>"
|
424 |
. "<input type='hidden' class='ls-pro-sku' value='" . $product->get_sku() . "'/>"
|
@@ -534,7 +658,8 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
534 |
* @access public
|
535 |
* @return void
|
536 |
*/
|
537 |
-
|
|
|
538 |
global $woocommerce;
|
539 |
if ($this->disable_tracking($this->ga_enhanced_ecommerce_tracking_enabled)) {
|
540 |
return;
|
@@ -590,3 +715,4 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
|
590 |
}
|
591 |
|
592 |
}
|
|
9 |
* @extends WC_Integration
|
10 |
* @author Sudhir Mishra <sudhirxps@gmail.com>
|
11 |
*/
|
12 |
+
|
13 |
class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
|
14 |
|
15 |
/**
|
21 |
public function __construct() {
|
22 |
$this->id = 'enhanced_ecommerce_google_analytics';
|
23 |
$this->method_title = __('Enhanced Ecommerce Google Analytics', 'woocommerce');
|
24 |
+
$this->method_description = __('Enhanced Ecommerce is a new feature of Universal Analytics that generates detailed statistics about the users journey from product page to thank you page on your e-store. <br/><a href="http://www.tatvic.com/blog/enhanced-ecommerce/">Know more about enhanced e-commerce.</a>', 'woocommerce');
|
25 |
|
26 |
// Load the settings.
|
27 |
$this->init_form_fields();
|
35 |
$this->enable_guest_checkout = get_option('woocommerce_enable_guest_checkout') == 'yes' ? true : false;
|
36 |
$this->track_login_step_for_guest_user = $this->get_option('track_login_step_for_guest_user') == 'yes' ? true : false;
|
37 |
$this->ga_enhanced_ecommerce_tracking_enabled = $this->get_option('ga_enhanced_ecommerce_tracking_enabled');
|
38 |
+
$this->ga_enhanced_ecommerce_category_page_impression_thresold = $this->get_option('ga_enhanced_ecommerce_category_page_impression_thresold');
|
39 |
+
|
40 |
// Actions
|
41 |
add_action('woocommerce_update_options_integration_enhanced_ecommerce_google_analytics', array($this, 'process_admin_options'));
|
42 |
// API Call to LS with e-mail
|
45 |
add_action('woocommerce_thankyou', array($this, 'ecommerce_tracking_code'));
|
46 |
|
47 |
// Enhanced Ecommerce product impression hook
|
48 |
+
add_action('woocommerce_after_shop_loop', array($this, 'cate_page_prod_impression')); // Hook for category page
|
49 |
add_action('woocommerce_after_shop_loop_item', array($this, 'product_impression'));
|
50 |
add_action('woocommerce_after_single_product', array($this, 'product_detail_view'));
|
51 |
add_action('woocommerce_after_cart', array($this, 'remove_cart_tracking'));
|
105 |
'checkboxgroup' => '',
|
106 |
'description' => sprintf(__('For Guest users Login is not a mandatory step. Checking the box would consider the click event on place order as Login as well as Checkout.', 'woocommerce')),
|
107 |
'default' => get_option('track_login_step_for_guest_user') ? get_option('track_login_step_for_guest_user') : 'no' // Backwards compat
|
108 |
+
),
|
109 |
+
'ga_enhanced_ecommerce_category_page_impression_thresold' => array(
|
110 |
+
'title' => __('Impression Threasold', 'woocommerce'),
|
111 |
+
'description' => sprintf(__('Impression thresold for category page. Send hit after these many number of products impressions', 'woocommerce')),
|
112 |
+
'type' => 'input',
|
113 |
+
'default' => '6'
|
114 |
)
|
115 |
);
|
116 |
/* When user updates the email, post it to the remote server */
|
162 |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
163 |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
164 |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
165 |
+
//Plugin Version :1.0.6.1
|
166 |
ga('create', '" . esc_js($tracking_id) . "', '" . $set_domain_name . "');
|
167 |
ga('require', 'ec', 'ec.js');
|
168 |
</script>";
|
169 |
+
|
170 |
+
}
|
171 |
|
172 |
/**
|
173 |
* Google Analytics eCommerce tracking
|
202 |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
203 |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
204 |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
205 |
+
//Plugin Version :1.0.6.1
|
206 |
ga('create', '" . esc_js($tracking_id) . "', '" . $set_domain_name . "');
|
207 |
ga('require', 'ec', 'ec.js');
|
208 |
+
|
209 |
|
210 |
";
|
211 |
+
|
212 |
+
|
213 |
// Order items
|
214 |
if ($order->get_items()) {
|
215 |
foreach ($order->get_items() as $item) {
|
216 |
$_product = $order->get_product_from_item($item);
|
217 |
|
218 |
+
$code .= "ga('ec:addProduct', {";
|
219 |
$code .= "'name': '" . esc_js($item['name']) . "',";
|
220 |
+
$code .= "'id': '" . esc_js($_product->get_sku()) . "',";
|
221 |
+
|
222 |
if (isset($_product->variation_data)) {
|
223 |
|
224 |
$code .= "'category': '" . esc_js(woocommerce_get_formatted_variation($_product->variation_data, true)) . "',";
|
252 |
update_post_meta($order_id, '_ga_tracked', 1);
|
253 |
}
|
254 |
|
255 |
+
/**
|
256 |
+
* Enhanced E-commerce tracking for product impressions on category page
|
257 |
+
*
|
258 |
+
* @access public
|
259 |
+
* @return void
|
260 |
+
*/
|
261 |
+
public function cate_page_prod_impression() {
|
262 |
+
|
263 |
+
if ($this->disable_tracking($this->ga_enhanced_ecommerce_tracking_enabled)) {
|
264 |
+
return;
|
265 |
+
}
|
266 |
+
$t_category="";
|
267 |
+
if(is_search()){
|
268 |
+
$t_category="Search Results";
|
269 |
+
}
|
270 |
+
global $product, $woocommerce;
|
271 |
+
$impression_thresold = $this->ga_enhanced_ecommerce_category_page_impression_thresold;
|
272 |
+
|
273 |
+
//$parameters = array();
|
274 |
+
//$parameters['label'] = "'" . esc_js($product->get_sku() ? __('SKU:', 'woocommerce') . ' ' . $product->get_sku() : "#" . $product->id ) . "'";
|
275 |
+
if (version_compare($woocommerce->version, '2.1', '>=')) {
|
276 |
+
wc_enqueue_js("
|
277 |
+
t_cnt=0;
|
278 |
+
t_ttl_prod=jQuery('.products li').length;
|
279 |
+
jQuery('.products li').each(function(index){
|
280 |
+
t_cnt++;
|
281 |
+
ga('ec:addImpression', {
|
282 |
+
'id': jQuery(this).find('.ls-pro-sku').val(),
|
283 |
+
'name': jQuery(this).find('.ls-pro-name').val(),
|
284 |
+
'category': jQuery(this).find('.ls-pro-category').val(),
|
285 |
+
'price': jQuery(this).find('.ls-pro-price').val(),
|
286 |
+
'position': index+1
|
287 |
+
});
|
288 |
+
|
289 |
+
if(t_ttl_prod > " .esc_js($impression_thresold)."){
|
290 |
+
if((t_cnt%" .esc_js($impression_thresold).")==0){
|
291 |
+
t_ttl_prod=t_ttl_prod-".esc_js($impression_thresold).";
|
292 |
+
ga('send', 'event', 'ecommerce', 'product_impression_cp', {'nonInteraction': 1});
|
293 |
+
}
|
294 |
+
}else{
|
295 |
+
t_ttl_prod--;
|
296 |
+
if(t_ttl_prod==0){
|
297 |
+
ga('send', 'event', 'ecommerce', 'product_impression_cp', {'nonInteraction': 1});
|
298 |
+
}
|
299 |
+
}
|
300 |
+
|
301 |
+
jQuery(this).find('a:not(.add_to_cart_button)').on('click',function(){
|
302 |
+
|
303 |
+
if('".esc_js($t_category)."'==''){
|
304 |
+
t_category=jQuery(this).parents('li').find('.ls-pro-category').val();
|
305 |
+
}else{
|
306 |
+
t_category='".esc_js($t_category)."';
|
307 |
+
}
|
308 |
+
ga('ec:addProduct', {
|
309 |
+
'id': jQuery(this).parents('li').find('.ls-pro-sku').val(),
|
310 |
+
'name': jQuery(this).parents('li').find('.ls-pro-name').val(),
|
311 |
+
'category': jQuery(this).parents('li').find('.ls-pro-category').val(),
|
312 |
+
'price': jQuery(this).parents('li').find('.ls-pro-price').val(),
|
313 |
+
'position': index+1
|
314 |
+
});
|
315 |
+
ga('ec:setAction', 'click', {list: t_category});
|
316 |
+
ga('send', 'event', 'ecommerce', 'product_click', {'nonInteraction': 1});
|
317 |
+
|
318 |
+
|
319 |
+
});
|
320 |
+
});
|
321 |
+
|
322 |
+
");
|
323 |
+
|
324 |
+
} else {
|
325 |
+
|
326 |
+
$woocommerce->add_inline_js("
|
327 |
+
t_cnt=0;
|
328 |
+
t_ttl_prod=jQuery('.products li').length;
|
329 |
+
jQuery('.products li').each(function(index){
|
330 |
+
t_cnt++;
|
331 |
+
ga('ec:addImpression', {
|
332 |
+
'id': jQuery(this).find('.ls-pro-sku').val(),
|
333 |
+
'name': jQuery(this).find('.ls-pro-name').val(),
|
334 |
+
'category': jQuery(this).find('.ls-pro-category').val(),
|
335 |
+
'price': jQuery(this).find('.ls-pro-price').val(),
|
336 |
+
'position': index+1
|
337 |
+
});
|
338 |
+
|
339 |
+
if(t_ttl_prod > " .esc_js($impression_thresold)."){
|
340 |
+
if((t_cnt%" .esc_js($impression_thresold).")==0){
|
341 |
+
t_ttl_prod=t_ttl_prod-".esc_js($impression_thresold).";
|
342 |
+
ga('send', 'event', 'ecommerce', 'product_impression_cp', {'nonInteraction': 1});
|
343 |
+
}
|
344 |
+
}else{
|
345 |
+
t_ttl_prod--;
|
346 |
+
if(t_ttl_prod==0){
|
347 |
+
ga('send', 'event', 'ecommerce', 'product_impression_cp', {'nonInteraction': 1});
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
jQuery(this).find('a:not(.add_to_cart_button)').on('click',function(){
|
352 |
+
|
353 |
+
if('".esc_js($t_category)."'==''){
|
354 |
+
t_category=jQuery(this).parents('li').find('.ls-pro-category').val();
|
355 |
+
}else{
|
356 |
+
t_category='".esc_js($t_category)."';
|
357 |
+
}
|
358 |
+
|
359 |
+
ga('ec:addProduct', {
|
360 |
+
'id': jQuery(this).parents('li').find('.ls-pro-sku').val(),
|
361 |
+
'name': jQuery(this).parents('li').find('.ls-pro-name').val(),
|
362 |
+
'category': jQuery(this).parents('li').find('.ls-pro-category').val(),
|
363 |
+
'price': jQuery(this).parents('li').find('.ls-pro-price').val(),
|
364 |
+
'position': index+1
|
365 |
+
});
|
366 |
+
ga('ec:setAction', 'click', {list: t_category});
|
367 |
+
ga('send', 'event', 'ecommerce', 'product_click', {'nonInteraction': 1});
|
368 |
+
|
369 |
+
|
370 |
+
});
|
371 |
+
});
|
372 |
+
|
373 |
+
");
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
/**
|
378 |
* Enhanced E-commerce tracking for single product add to cart
|
379 |
*
|
387 |
|
388 |
if (!is_single())
|
389 |
return;
|
390 |
+
|
391 |
global $product, $woocommerce;
|
392 |
|
393 |
$parameters = array();
|
448 |
if (version_compare($woocommerce->version, '2.1', '>=')) {
|
449 |
|
450 |
wc_enqueue_js("
|
451 |
+
$('.add_to_cart_button:not(.product_type_variable, .product_type_grouped)').click(function() {
|
452 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
// Enhanced E-commerce Add to cart clicks
|
454 |
ga('ec:addProduct', {
|
455 |
'id': $(this).parents('li').find('.ls-pro-sku').val(),
|
464 |
} else {
|
465 |
$woocommerce->add_inline_js("
|
466 |
$('.add_to_cart_button:not(.product_type_variable, .product_type_grouped)').click(function() {
|
467 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
468 |
// Enhanced E-commerce Add to cart clicks
|
469 |
ga('ec:addProduct', {
|
470 |
'id': $(this).parents('li').find('.ls-pro-sku').val(),
|
486 |
* @return void
|
487 |
*/
|
488 |
public function product_detail_view() {
|
489 |
+
|
490 |
if ($this->disable_tracking($this->ga_enhanced_ecommerce_tracking_enabled)) {
|
491 |
return;
|
492 |
}
|
541 |
foreach ($category as $term) {
|
542 |
$categories.=$term->name . ',';
|
543 |
}
|
544 |
+
//remove last comma(,) if multiple categories are there
|
545 |
+
$categories = rtrim($categories, ",");
|
546 |
|
547 |
echo "<input type='hidden' class='ls-pro-price' value='" . esc_html($product->get_price()) . "'/>"
|
548 |
. "<input type='hidden' class='ls-pro-sku' value='" . $product->get_sku() . "'/>"
|
658 |
* @access public
|
659 |
* @return void
|
660 |
*/
|
661 |
+
public function default_pageview() {
|
662 |
+
|
663 |
global $woocommerce;
|
664 |
if ($this->disable_tracking($this->ga_enhanced_ecommerce_tracking_enabled)) {
|
665 |
return;
|
715 |
}
|
716 |
|
717 |
}
|
718 |
+
?>
|
readme.txt
CHANGED
@@ -1,77 +1,90 @@
|
|
1 |
-
===
|
2 |
-
Contributors: Tatvic
|
3 |
-
Plugin Name: Enhanced Ecommerce for Woocommerce store
|
4 |
-
Plugin URI:
|
5 |
-
Tags: Google Analytics, Universal Analytics, Enhanced E-commerce, E-commerce, e-commerce, woo-commerce
|
6 |
-
Author URI: http://www.tatvic.com/
|
7 |
-
Author: Tatvic
|
8 |
-
Requires at least: 3.6
|
9 |
-
Tested up to: 3.
|
10 |
-
Stable tag: 1.0.
|
11 |
-
Version: 1.0.
|
12 |
-
License: GPLv3
|
13 |
-
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
14 |
-
|
15 |
-
Provides integration between Google Analytics Enhanced Ecommerce and WooCommerce.
|
16 |
-
|
17 |
-
== Description ==
|
18 |
-
|
19 |
-
|
20 |
-
=
|
21 |
-
|
22 |
-
|
23 |
-
*
|
24 |
-
*
|
25 |
-
*
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
ga('require','
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
*
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
=
|
45 |
-
*
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
==
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Enhanced Ecommerce Google Analytics Plugin for WooCommerce ===
|
2 |
+
Contributors: Tatvic
|
3 |
+
Plugin Name: Enhanced Ecommerce for Woocommerce store
|
4 |
+
Plugin URI: http://wordpress.org/plugins/enhanced-e-commerce-for-woocommerce-store/
|
5 |
+
Tags: Google Analytics, Universal Analytics, Enhanced E-commerce, E-commerce, e-commerce, woo-commerce,Ecommerce,woocommerce, commerce, Wordpress Enhanced Ecommerce
|
6 |
+
Author URI: http://www.tatvic.com/
|
7 |
+
Author: Tatvic
|
8 |
+
Requires at least: 3.6
|
9 |
+
Tested up to: 3.9.2
|
10 |
+
Stable tag: 1.0.6.1
|
11 |
+
Version: 1.0.6.1
|
12 |
+
License: GPLv3
|
13 |
+
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
14 |
+
|
15 |
+
Provides integration between Google Analytics Enhanced Ecommerce and WooCommerce.
|
16 |
+
|
17 |
+
== Description ==
|
18 |
+
<a href="http://www.tatvic.com/enhanced-ecommerce-google-analytics-plugin-woocommerce/">Enhanced Ecommerce Google Analytics</a> is a Free WooCommerce Plugin which allows you to use the newly launched feature of Google Analytics – Enhanced Ecommerce.You can track the user behavior across your e-commerce store starting from product views to thank you page.Enhanced Ecommerce is still in beta and supports only Universal Analytics.
|
19 |
+
|
20 |
+
= Features of Plugin =
|
21 |
+
1. Quick & Easy installation from the wordpress interface
|
22 |
+
2. Supports four New Reports in Enhanced Ecommerce
|
23 |
+
* Shopping Behaviour Report
|
24 |
+
* Checkout Behaviour Report
|
25 |
+
* Product Performance Report
|
26 |
+
* Sales Performance Report
|
27 |
+
3. Supports Guest checkout functionality
|
28 |
+
4. Captures Product Impressions events on the load of the category page and Add-to-Cart events when add-to-cart button is clicked
|
29 |
+
5. Captures Product Impressions events on the load of the product page and Add-to-Cart events when add-to-cart button is clicked
|
30 |
+
|
31 |
+
= Things to keep in mind before enabling the Enhanced E-commerce plugin =
|
32 |
+
* Enable Enhanced E-commerce for your profile/view. This is a profile / view level setting and can be accessed under Admin > View > E-commerce Settings
|
33 |
+
|
34 |
+
* Also, add meaningful labels for your checkout steps. We recommend you to label as, Step 1 : Checkout View; Step 2 : Login; Step 3 : Proceed to payment
|
35 |
+
|
36 |
+
* Remove standard E-commerce code from thank you along with the ecommerce.js which is included by <code>ga('require', 'ecommerce', 'ecommerce.js');</code>. If you are using a third party plugin for e-commerce tracking, you would have to disable the plugin.
|
37 |
+
|
38 |
+
* You need to include ec.js. This can be done by adding a single line of code below your default Google Analytics code snippet <code>ga('require', 'ec', 'ec.js');</code>
|
39 |
+
|
40 |
+
* Users who are using Universal Analytics Tag in GTM, you will have to replace it with a custom HTML tag. Add the following code in your customer HTML tag. After adding the code, kindly replace UA-XXXXXXX-Y with your Google Analytics Property ID.
|
41 |
+
<pre>
|
42 |
+
<!-- Google Analytics tag -->
|
43 |
+
<script>
|
44 |
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
45 |
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
46 |
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
47 |
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
48 |
+
|
49 |
+
ga('create', 'UA-XXXX-Y', 'auto');
|
50 |
+
ga('send', 'pageview');
|
51 |
+
ga('require','ec','ec.js');
|
52 |
+
</script>
|
53 |
+
<!-- End Google Analytics -->
|
54 |
+
</pre>
|
55 |
+
* After adding the above code, you will have to activate your plug-in from the Settings page. You can access the setting page from here WooCommerce -> Settings ->Integration ->Enhanced Ecommerce Google Analytics.
|
56 |
+
|
57 |
+
* Find “Enable Enhanced Ecommerce Tracking” in the settings page and check the box to enable the plugin
|
58 |
+
|
59 |
+
* If you have a guest checkout on your WooCommerce store, then Check the box “Track Login Steps For Guest Users”. If you have a guest login but you do not check the box, then it might cause an uneven funnel reporting in Google Analytics.
|
60 |
+
|
61 |
+
== Installation ==
|
62 |
+
1. Download the plugin file to your computer and unzip it
|
63 |
+
2. Using an FTP program, or your hosting control panel, upload the unzipped plugin folder to your WordPress installation’s wp-content/plugins/ directory
|
64 |
+
3. Activate the plugin from the Plugins menu within the WordPress admin
|
65 |
+
4. Enter your email-address and Google Analytics ID for the plugin to enable the tracking code
|
66 |
+
|
67 |
+
== Screenshots ==
|
68 |
+
1. Enable Enhanced E-commerce for your profile/view. This is a profile / view level setting and can be accessed under Admin > View > E-commerce Settings. Also, add meaningful labels for your checkout steps. We recommend you to label as, Step 1 : Checkout View; Step 2 : Login; Step 3 : Proceed to payment;
|
69 |
+
2. Next, you need to activate your plugin from the Settings page for the plugin accessed under, WooCommerce > Settings > Integration > Enhanced Ecommerce Google Analytics
|
70 |
+
3. For tracking the Guest users, you need to check the box. Unchecking the box might cause an uneven funnel reported to Google Analytics.
|
71 |
+
|
72 |
+
|
73 |
+
== Frequently Asked Questions ==
|
74 |
+
= Where can I find the setting for this plugin? =
|
75 |
+
|
76 |
+
This plugin will add the settings to the Integration tab, to be found in the WooCommerce > Settings menu.
|
77 |
+
|
78 |
+
= Does this conflict with the WooCommerce? =
|
79 |
+
|
80 |
+
Starting the WooCommerce 2.1 release there are no conflicts. However for earlier the plugin might conflict with the default Google Analytics integration for WooCommerce.
|
81 |
+
|
82 |
+
== Changelog ==
|
83 |
+
|
84 |
+
= 1.0 - 25/06/2014 =
|
85 |
+
* Initial release
|
86 |
+
|
87 |
+
= 1.0.6.1 - 15/08/2014 =
|
88 |
+
* Added new feature - Product impressions and Product click on category page view , including the default pagination
|
89 |
+
* Fixed-Allow Special Characters in javascript
|
90 |
+
|
woocommerce-enhanced-ecommerce-google-analytics-integration.php
CHANGED
@@ -17,11 +17,11 @@
|
|
17 |
*/
|
18 |
/*
|
19 |
Plugin Name: Enhanced E-commerce for Woocommerce store
|
20 |
-
Plugin URI: http://www.tatvic.com/enhanced-ecommerce-
|
21 |
Description: Allows Enhanced E-commerce Google Analytics tracking code to be inserted into WooCommerce store pages.
|
22 |
Author: Tatvic
|
23 |
Author URI: http://www.tatvic.com
|
24 |
-
Version: 1.0
|
25 |
*/
|
26 |
|
27 |
// Add the integration to WooCommerce
|
17 |
*/
|
18 |
/*
|
19 |
Plugin Name: Enhanced E-commerce for Woocommerce store
|
20 |
+
Plugin URI: http://www.tatvic.com/enhanced-ecommerce-google-analytics-plugin-woocommerce/
|
21 |
Description: Allows Enhanced E-commerce Google Analytics tracking code to be inserted into WooCommerce store pages.
|
22 |
Author: Tatvic
|
23 |
Author URI: http://www.tatvic.com
|
24 |
+
Version: 1.0.6.1
|
25 |
*/
|
26 |
|
27 |
// Add the integration to WooCommerce
|