Woopra_Analytics_Event_And_Visitor_Tracking - Version 1.1.0

Version Notes

Updated javascript tracking code.
Moved script to header, loads async, can capture tracking data if user navigates away before page load complete.
Updated reserved properties (again) customer_name, customer_email, customer_company to name, email, company.
Modified shopping cart and wishlist to send values even if empty in order to show correct values when everything is removed.
Corrected undefined variables for wishlistItems and wishListTotal.
Corrected undefined property for $_orderStateValue by adding setOrderStateFilter to $customerTotals, used when pulling Customer Lifetime data.

Download this release

Release Info

Developer Woopra
Extension Woopra_Analytics_Event_And_Visitor_Tracking
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.2 to 1.1.0

app/code/community/Woopra/Analytics/Block/Script.php CHANGED
@@ -112,21 +112,24 @@ class Woopra_Analytics_Block_Script extends Mage_Core_Block_Template
112
 
113
  //Customer Lifetime Array
114
  $customerTotals = Mage::getResourceModel('sales/sale_collection')
 
115
  ->setCustomerFilter($customer)
116
  ->load()
117
  ->getTotals();
118
  //Customer Lifetime Sales Count
119
- if (Mage::helper('woopra')->getCustomerLifetimeSales() != NULL && $data['group'] != 'NOT LOGGED IN') {
120
  $data['customer_lifetime_sales'] = round($customerTotals->getLifetime(), 2);
121
  }
122
  //Customer Lifetime Orders
123
- if (Mage::helper('woopra')->getCustomerNumberOrders() != NULL && $data['group'] != 'NOT LOGGED IN') {
124
  $data['customer_number_orders'] = $customerTotals->getNumOrders();
125
  }
126
 
127
  //Customer Wishlist Array
128
  $wishList = Mage::getSingleton('wishlist/wishlist')->loadByCustomer($customer);
129
  $wishListItemCollection = $wishList->getItemCollection();
 
 
130
  foreach ($wishListItemCollection as $item) {
131
  $product = $item->getProduct();
132
  $wishlistItems = $wishlistItems + 1;
112
 
113
  //Customer Lifetime Array
114
  $customerTotals = Mage::getResourceModel('sales/sale_collection')
115
+ ->setOrderStateFilter(Mage_Sales_Model_Order::STATE_CANCELED, true)
116
  ->setCustomerFilter($customer)
117
  ->load()
118
  ->getTotals();
119
  //Customer Lifetime Sales Count
120
+ if (Mage::helper('woopra')->getCustomerLifetimeSales() != NULL && $group != 'NOT LOGGED IN') {
121
  $data['customer_lifetime_sales'] = round($customerTotals->getLifetime(), 2);
122
  }
123
  //Customer Lifetime Orders
124
+ if (Mage::helper('woopra')->getCustomerNumberOrders() != NULL && $group != 'NOT LOGGED IN') {
125
  $data['customer_number_orders'] = $customerTotals->getNumOrders();
126
  }
127
 
128
  //Customer Wishlist Array
129
  $wishList = Mage::getSingleton('wishlist/wishlist')->loadByCustomer($customer);
130
  $wishListItemCollection = $wishList->getItemCollection();
131
+ $wishlistItems = 0;
132
+ $wishListTotal = 0;
133
  foreach ($wishListItemCollection as $item) {
134
  $product = $item->getProduct();
135
  $wishlistItems = $wishlistItems + 1;
app/code/community/Woopra/Analytics/Helper/Data.php CHANGED
@@ -80,15 +80,15 @@ class Woopra_Analytics_Helper_Data extends Mage_Core_Helper_Abstract
80
  }
81
  public function getCustomerName()
82
  {
83
- return Mage::getStoreConfig('woopra_analytics/woopra_outputs/customer_name');
84
  }
85
  public function getCustomerEmail()
86
  {
87
- return Mage::getStoreConfig('woopra_analytics/woopra_outputs/customer_email');
88
  }
89
  public function getCustomerCompany()
90
  {
91
- return Mage::getStoreConfig('woopra_analytics/woopra_outputs/customer_company');
92
  }
93
  public function getCustomerLocation()
94
  {
80
  }
81
  public function getCustomerName()
82
  {
83
+ return Mage::getStoreConfig('woopra_analytics/woopra_outputs/name');
84
  }
85
  public function getCustomerEmail()
86
  {
87
+ return Mage::getStoreConfig('woopra_analytics/woopra_outputs/email');
88
  }
89
  public function getCustomerCompany()
90
  {
91
+ return Mage::getStoreConfig('woopra_analytics/woopra_outputs/company');
92
  }
93
  public function getCustomerLocation()
94
  {
app/code/community/Woopra/Analytics/etc/config.xml CHANGED
@@ -12,7 +12,7 @@
12
  <config>
13
  <modules>
14
  <Woopra_Analytics>
15
- <version>1.0.0</version>
16
  </Woopra_Analytics>
17
  </modules>
18
  <global>
@@ -84,9 +84,9 @@
84
  <outgoing_tracking_pause></outgoing_tracking_pause>
85
  </woopra_advanced>
86
  <woopra_outputs>
87
- <customer_name>name</customer_name>
88
- <customer_email>email</customer_email>
89
- <customer_company>company</customer_company>
90
  <customer_location>customer_location</customer_location>
91
  <customer_phone>customer_phone</customer_phone>
92
  <customer_group>customer_group</customer_group>
12
  <config>
13
  <modules>
14
  <Woopra_Analytics>
15
+ <version>1.1.0</version>
16
  </Woopra_Analytics>
17
  </modules>
18
  <global>
84
  <outgoing_tracking_pause></outgoing_tracking_pause>
85
  </woopra_advanced>
86
  <woopra_outputs>
87
+ <name>name</name>
88
+ <email>email</email>
89
+ <company>company</company>
90
  <customer_location>customer_location</customer_location>
91
  <customer_phone>customer_phone</customer_phone>
92
  <customer_group>customer_group</customer_group>
app/code/community/Woopra/Analytics/etc/system.xml CHANGED
@@ -201,7 +201,7 @@
201
  </outgoing_tracking>
202
  <outgoing_tracking_pause translate="label">
203
  <label>Outgoing Link Tracking Pause</label>
204
- <comment>Change outgoing link pause to guarantee the tracking request is sent (Default: 200 milliseconds)</comment>
205
  <frontend_type>text</frontend_type>
206
  <validate>validate-digits</validate>
207
  <sort_order>120</sort_order>
@@ -221,7 +221,7 @@
221
  <expanded>0</expanded>
222
  <comment>You can disable outputs here that you do not want to use. On some servers a performance gain may be noticed by disabling unused calls.</comment>
223
  <fields>
224
- <customer_name translate="label">
225
  <label>Customer Name</label>
226
  <comment>Customer name output name (empty to disable). Note: This is a reserved property and should not be changed!</comment>
227
  <frontend_type>text</frontend_type>
@@ -229,8 +229,8 @@
229
  <show_in_default>1</show_in_default>
230
  <show_in_website>1</show_in_website>
231
  <show_in_store>1</show_in_store>
232
- </customer_name>
233
- <customer_email translate="label">
234
  <label>Customer Email</label>
235
  <comment>Customer email output name (empty to disable). Note: This is a reserved property and should not be changed!</comment>
236
  <frontend_type>text</frontend_type>
@@ -238,8 +238,8 @@
238
  <show_in_default>1</show_in_default>
239
  <show_in_website>1</show_in_website>
240
  <show_in_store>1</show_in_store>
241
- </customer_email>
242
- <customer_company translate="label">
243
  <label>Customer Company</label>
244
  <comment>Customer company output name (empty to disable). Note: This is a reserved property and should not be changed!</comment>
245
  <frontend_type>text</frontend_type>
@@ -247,7 +247,7 @@
247
  <show_in_default>1</show_in_default>
248
  <show_in_website>1</show_in_website>
249
  <show_in_store>1</show_in_store>
250
- </customer_company>
251
  <customer_location translate="label">
252
  <label>Customer Location</label>
253
  <comment>Customer location output name (empty to disable).</comment>
201
  </outgoing_tracking>
202
  <outgoing_tracking_pause translate="label">
203
  <label>Outgoing Link Tracking Pause</label>
204
+ <comment>Change outgoing link pause to guarantee the tracking request is sent (Default: 400 milliseconds)</comment>
205
  <frontend_type>text</frontend_type>
206
  <validate>validate-digits</validate>
207
  <sort_order>120</sort_order>
221
  <expanded>0</expanded>
222
  <comment>You can disable outputs here that you do not want to use. On some servers a performance gain may be noticed by disabling unused calls.</comment>
223
  <fields>
224
+ <name translate="label">
225
  <label>Customer Name</label>
226
  <comment>Customer name output name (empty to disable). Note: This is a reserved property and should not be changed!</comment>
227
  <frontend_type>text</frontend_type>
229
  <show_in_default>1</show_in_default>
230
  <show_in_website>1</show_in_website>
231
  <show_in_store>1</show_in_store>
232
+ </name>
233
+ <email translate="label">
234
  <label>Customer Email</label>
235
  <comment>Customer email output name (empty to disable). Note: This is a reserved property and should not be changed!</comment>
236
  <frontend_type>text</frontend_type>
238
  <show_in_default>1</show_in_default>
239
  <show_in_website>1</show_in_website>
240
  <show_in_store>1</show_in_store>
241
+ </email>
242
+ <company translate="label">
243
  <label>Customer Company</label>
244
  <comment>Customer company output name (empty to disable). Note: This is a reserved property and should not be changed!</comment>
245
  <frontend_type>text</frontend_type>
247
  <show_in_default>1</show_in_default>
248
  <show_in_website>1</show_in_website>
249
  <show_in_store>1</show_in_store>
250
+ </company>
251
  <customer_location translate="label">
252
  <label>Customer Location</label>
253
  <comment>Customer location output name (empty to disable).</comment>
app/design/frontend/base/default/layout/woopra.xml CHANGED
@@ -11,7 +11,7 @@
11
  -->
12
  <layout>
13
  <default>
14
- <reference name="before_body_end">
15
  <block type="woopra/script" name="woopra" as="woopra" template="woopra/script.phtml"/>
16
  </reference>
17
  </default>
11
  -->
12
  <layout>
13
  <default>
14
+ <reference name="head">
15
  <block type="woopra/script" name="woopra" as="woopra" template="woopra/script.phtml"/>
16
  </reference>
17
  </default>
app/design/frontend/base/default/template/woopra/script.phtml CHANGED
@@ -28,7 +28,7 @@ Checkout.prototype.gotoSection = function(section) {
28
  else if (woopra_action == 'review')
29
  woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutReview(); ?>';
30
  try {
31
- woopraTracker.pushEvent({
32
  name: ''+woopra_action+''
33
  });
34
  } catch(err) { }
@@ -39,40 +39,44 @@ Checkout.prototype.gotoSection = function(section) {
39
  </script>
40
  <?php } ?>
41
  <script type="text/javascript">
42
- function woopraReady(tracker) {
 
 
 
43
  <?php if ($this->getSetting('tracking_cookie_expiration') != NULL) { ?> var expires = new Date();<?php echo "\n"; ?>
44
  expires.setDate(expires.getDate() + <?php echo $this->getSetting('tracking_cookie_expiration'); ?>);
45
- tracker.option('cookie_expire', expires);<?php echo "\n"; } ?>
46
- <?php if ($this->getSetting('tracking_cookie_name') != NULL) { ?> tracker.option('cookie_name', '<?php echo $this->getSetting('tracking_cookie_name'); ?>');<?php echo "\n"; } ?>
47
- <?php if ($this->getSetting('tracking_cookie_domain') != NULL) { ?> tracker.option('cookie_domain', '<?php echo $this->getSetting('tracking_cookie_domain'); ?>');<?php echo "\n"; } ?>
48
- <?php if ($this->getSetting('tracking_cookie_path') != NULL) { ?> tracker.option('cookie_path', '<?php echo $this->getSetting('tracking_cookie_path'); ?>');<?php echo "\n"; } ?>
49
- <?php if ($this->getSetting('ping') == 0) { ?> tracker.option('ping', false);<?php echo "\n"; } ?>
50
- <?php if ($this->getSetting('ping_interval') != NULL && $this->getSetting('ping') == 1) { ?> tracker.option('ping_interval', <?php echo $this->getSetting('ping_interval'); ?>);<?php echo "\n"; } ?>
51
- <?php if ($this->getSetting('download_tracking') == 0) { ?> tracker.option('download_tracking', false);<?php echo "\n"; } ?>
52
- <?php if ($this->getSetting('download_tracking_pause') != NULL && $this->getSetting('download_tracking') == 1) { ?> tracker.option('download_pause', <?php echo $this->getSetting('download_tracking_pause'); ?>);<?php echo "\n"; } ?>
53
- <?php if ($this->getSetting('outgoing_tracking') == 0) { ?> tracker.option('outgoing_tracking', false);<?php echo "\n"; } ?>
54
- <?php if ($this->getSetting('outgoing_tracking_pause') != NULL && $this->getSetting('outgoing_tracking') == 1) { ?> tracker.option('outgoing_pause', <?php echo $this->getSetting('outgoing_tracking_pause'); ?>);<?php echo "\n"; } ?>
55
- <?php if ($this->getSetting('hostname') != NULL) { ?> tracker.setDomain('<?php echo $this->getSetting('hostname'); ?>');<?php echo "\n"; ?>
56
- <?php } else { ?> tracker.setDomain('<?php echo $this->getSetting('url'); ?>');<?php echo "\n"; } ?>
57
- <?php if ($this->getSetting('visitor_timeout') != NULL) { ?> tracker.setIdleTimeout(<?php echo $this->getSetting('visitor_timeout') * 60 * 1000; ?>);<?php echo "\n"; ?>
58
- <?php } else { ?> tracker.setIdleTimeout(1800000);<?php echo "\n"; } ?>
59
- <?php if ($this->getSetting('subdomain') != NULL) { ?> tracker.option(<?php echo $this->getSetting('subdomain'); ?>);<?php echo "\n"; } ?>
60
- <?php if ($this->getSetting('customer_name') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerName(); ?>', '<?php echo $this->getSetting('customer_name'); ?>');<?php echo "\n"; } ?>
61
- <?php if ($this->getSetting('customer_email') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerEmail(); ?>', '<?php echo $this->getSetting('customer_email'); ?>');<?php echo "\n"; } ?>
62
- <?php if ($this->getSetting('customer_company') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerCompany(); ?>', '<?php echo $this->getSetting('customer_company'); ?>');<?php echo "\n"; } ?>
63
- <?php if ($this->getSetting('customer_location') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerLocation(); ?>', '<?php echo $this->getSetting('customer_location'); ?>');<?php echo "\n"; } ?>
64
- <?php if ($this->getSetting('customer_phone') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerPhone(); ?>', '<?php echo $this->getSetting('customer_phone'); ?>');<?php echo "\n"; } ?>
65
- <?php if ($this->getSetting('customer_group') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerGroup(); ?>', '<?php echo $this->getSetting('customer_group'); ?>');<?php echo "\n"; } ?>
66
- <?php if ($this->getSetting('customer_lifetime_sales') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerLifetimeSales(); ?>', '<?php echo $this->getSetting('customer_lifetime_sales'); ?>');<?php echo "\n"; } ?>
67
- <?php if ($this->getSetting('customer_number_orders') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerNumberOrders(); ?>', '<?php echo $this->getSetting('customer_number_orders'); ?>');<?php echo "\n"; } ?>
68
- <?php if ($this->getSetting('customer_create_date') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerCreateDate(); ?>', '<?php echo $this->getSetting('customer_create_date'); ?>');<?php echo "\n"; } ?>
69
- <?php if ($this->getSetting('customer_cart_items') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerCartItems(); ?>', '<?php echo $this->getSetting('customer_cart_items'); ?>');<?php echo "\n"; } ?>
70
- <?php if ($this->getSetting('customer_cart_total') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerCartTotal(); ?>', '<?php echo $this->getSetting('customer_cart_total'); ?>');<?php echo "\n"; } ?>
71
- <?php if ($this->getSetting('customer_wishlist_items') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerWishlistItems(); ?>', '<?php echo $this->getSetting('customer_wishlist_items'); ?>');<?php echo "\n"; } ?>
72
- <?php if ($this->getSetting('customer_wishlist_total') != NULL) { ?> tracker.addVisitorProperty('<?php echo Mage::helper('woopra')->getCustomerWishlistTotal(); ?>', '<?php echo $this->getSetting('customer_wishlist_total'); ?>');<?php echo "\n"; } ?>
73
- <?php if ($this->getSetting('track_url_parameters') == 1) { ?> tracker.trackPageview({type:'pageview',url:window.location.pathname+window.location.search,title:document.title});<?php echo "\n"; ?>
74
- <?php } else { ?> tracker.track();<?php echo "\n"; } ?>
75
- <?php if ($this->getSetting('woopra_cart_wishlist_trigger') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
 
76
  name: '<?php echo $this->getSetting('woopra_cart_wishlist_status'); ?>',
77
  product_name: '<?php echo $this->getSetting('woopra_cart_wishlist_name'); ?>',
78
  product_sku: '<?php echo $this->getSetting('woopra_cart_wishlist_sku'); ?>',
@@ -85,61 +89,61 @@ function woopraReady(tracker) {
85
  product_tagged: '<?php echo $this->getSetting('woopra_product_tag_name'); ?>'<?php } ?>
86
  <?php } echo "\n";?>
87
  <?php echo " });\n"; } ?>
88
- <?php if ($this->getSetting('woopra_subscriber_changed') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
89
  name: '<?php echo $this->getSetting('woopra_subscriber_status'); ?>',
90
  email: '<?php echo $this->getSetting('woopra_subscriber_email'); ?>'
91
  <?php echo " });\n"; } ?>
92
- <?php if ($this->getSetting('woopra_contacts_index_post') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
93
  name: '<?php echo Mage::helper('woopra')->getContactFormSent(); ?>',
94
  customer_name: '<?php echo $this->getSetting('woopra_contacts_name'); ?>',
95
  customer_email: '<?php echo $this->getSetting('woopra_contacts_email'); ?>',
96
  customer_telephone: '<?php echo $this->getSetting('woopra_contacts_telephone'); ?>',
97
  customer_comment: '<?php echo $this->getSetting('woopra_contacts_comment'); ?>'
98
  <?php echo " });\n"; } ?>
99
- <?php if ($this->getSetting('woopra_search_trigger') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
100
  name: '<?php echo Mage::helper('woopra')->getCatalogSearch(); ?>',
101
  keywords: '<?php echo $this->getSetting('woopra_search_keywords'); ?>'
102
  <?php echo " });\n"; } ?>
103
- <?php if ($this->getSetting('woopra_cms_noroute_trigger') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
104
  name: '<?php echo Mage::helper('woopra')->getCmsNoRoute(); ?>',
105
  path: '<?php echo $this->getSetting('woopra_cms_noroute_path'); ?>',
106
  url: '<?php echo $this->getSetting('woopra_cms_noroute_url'); ?>'
107
  <?php echo " });\n"; } ?>
108
- <?php if ($this->getSetting('woopra_forgot_password_trigger') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
109
  name: '<?php echo Mage::helper('woopra')->getForgotPassword(); ?>',
110
  email: '<?php echo $this->getSetting('woopra_forgot_password_email'); ?>'
111
  <?php echo " });\n"; } ?>
112
- <?php if ($this->getSetting('woopra_estimate_post_trigger') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
113
  name: '<?php echo Mage::helper('woopra')->getEstimatePost(); ?>',
114
  country: '<?php echo $this->getSetting('woopra_estimate_post_country'); ?>',
115
  state: '<?php echo $this->getSetting('woopra_estimate_post_state'); ?>',
116
  zip: '<?php echo $this->getSetting('woopra_estimate_post_zip'); ?>'
117
  <?php echo " });\n"; } ?>
118
- <?php if ($this->getSetting('woopra_password_changed_trigger') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
119
  name: '<?php echo Mage::helper('woopra')->getChangedPassword(); ?>'
120
  <?php echo " });\n"; } ?>
121
- <?php if ($this->getSetting('woopra_create_account_trigger') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
122
  name: '<?php echo Mage::helper('woopra')->getCustomerCreateAccount(); ?>'
123
  <?php echo " });\n"; } ?>
124
- <?php if ($this->getSetting('woopra_create_account_success_trigger') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
125
  name: '<?php echo Mage::helper('woopra')->getCustomerCreateAccountSuccess(); ?>'
126
  <?php echo " });\n"; } ?>
127
- <?php if ($this->getSetting('woopra_poll_vote_trigger') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
128
  name: '<?php echo Mage::helper('woopra')->getPollVote(); ?>',
129
  poll_title: '<?php echo $this->getSetting('woopra_poll_vote_title'); ?>',
130
  poll_vote: '<?php echo $this->getSetting('woopra_poll_vote_answer'); ?>'
131
  <?php echo " });\n"; } ?>
132
- <?php if ($this->getSetting('woopra_coupon_code_trigger') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
133
  name: '<?php echo $this->getSetting('woopra_coupon_code_status'); ?>',
134
  coupon_code: '<?php echo $this->getSetting('woopra_coupon_code'); ?>',
135
  coupon_code_active: '<?php echo $this->getSetting('woopra_coupon_code_active'); ?>',
136
  coupon_code_name: '<?php echo $this->getSetting('woopra_coupon_code_name'); ?>',
137
  coupon_code_validity: '<?php echo $this->getSetting('woopra_coupon_code_validity'); ?>'
138
  <?php echo " });\n"; } ?>
139
- <?php if ($this->getSetting('woopra_login_logout_trigger') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
140
  name: '<?php echo $this->getSetting('woopra_login_logout_status'); ?>'
141
  <?php echo " });\n"; } ?>
142
- <?php if ($this->getSetting('woopra_checkout_success_trigger') == 1) { ?> tracker.pushEvent({<?php echo "\n";?>
143
  name: '<?php echo Mage::helper('woopra')->getCheckoutSuccess(); ?>',
144
  <?php if ($this->getSetting('woopra_checkout_success_coupon_code') != NULL) { ?> coupon_code: '<?php echo $this->getSetting('woopra_checkout_success_coupon_code'); ?>',<?php echo "\n"; } ?>
145
  <?php if ($this->getSetting('woopra_checkout_success_discount_amount') != 0) { ?> discount_amount: '<?php echo $this->getSetting('woopra_checkout_success_discount_amount'); ?>',<?php echo "\n"; } ?>
@@ -154,16 +158,6 @@ function woopraReady(tracker) {
154
  shipping_method: '<?php echo $this->getSetting('woopra_checkout_success_shipping_description'); ?>',
155
  total_items_ordered: '<?php echo $this->getSetting('woopra_checkout_success_total_items_ordered'); ?>'
156
  <?php echo " });\n"; } ?>
157
- return false;
158
- }
159
- (function(){
160
- var wsc = document.createElement('script');
161
- wsc.src = document.location.protocol+'//static.woopra.com/js/woopra.js';
162
- wsc.type = 'text/javascript';
163
- wsc.async = true;
164
- var ssc = document.getElementsByTagName('script')[0];
165
- ssc.parentNode.insertBefore(wsc, ssc);
166
- })();
167
  </script>
168
 
169
  <?php if($this->getSetting('test')) { ?>
28
  else if (woopra_action == 'review')
29
  woopra_action = '<?php echo Mage::helper('woopra')->getCheckoutReview(); ?>';
30
  try {
31
+ woopra.track({
32
  name: ''+woopra_action+''
33
  });
34
  } catch(err) { }
39
  </script>
40
  <?php } ?>
41
  <script type="text/javascript">
42
+ (function(){
43
+ var t,i,e,n=window,o=document,a=arguments,s="script",r=["config","track","identify","visit","push","call"],c=function(){var t,i=this;for(i._e=[],t=0;r.length>t;t++)(function(t){i[t]=function(){return i._e.push([t].concat(Array.prototype.slice.call(arguments,0))),i}})(r[t])};for(n._w=n._w||{},t=0;a.length>t;t++)n._w[a[t]]=n[a[t]]=n[a[t]]||new c;i=o.createElement(s),i.async=1,i.src="//static.woopra.com/js/w.js",e=o.getElementsByTagName(s)[0],e.parentNode.insertBefore(i,e)
44
+ })("woopra");
45
+ woopra.config('app', 'magento');
46
  <?php if ($this->getSetting('tracking_cookie_expiration') != NULL) { ?> var expires = new Date();<?php echo "\n"; ?>
47
  expires.setDate(expires.getDate() + <?php echo $this->getSetting('tracking_cookie_expiration'); ?>);
48
+ woopra.config('cookie_expire', expires);<?php echo "\n"; } ?>
49
+ <?php if ($this->getSetting('tracking_cookie_name') != NULL) { ?> woopra.config('cookie_name', '<?php echo $this->getSetting('tracking_cookie_name'); ?>');<?php echo "\n"; } ?>
50
+ <?php if ($this->getSetting('tracking_cookie_domain') != NULL) { ?> woopra.config('cookie_domain', '<?php echo $this->getSetting('tracking_cookie_domain'); ?>');<?php echo "\n"; } ?>
51
+ <?php if ($this->getSetting('tracking_cookie_path') != NULL) { ?> woopra.config('cookie_path', '<?php echo $this->getSetting('tracking_cookie_path'); ?>');<?php echo "\n"; } ?>
52
+ <?php if ($this->getSetting('ping') == 0) { ?> woopra.config('ping', false);<?php echo "\n"; } ?>
53
+ <?php if ($this->getSetting('ping_interval') != NULL && $this->getSetting('ping') == 1) { ?> woopra.config('ping_interval', <?php echo $this->getSetting('ping_interval'); ?>);<?php echo "\n"; } ?>
54
+ <?php if ($this->getSetting('download_tracking') == 0) { ?> woopra.config('download_tracking', false);<?php echo "\n"; } ?>
55
+ <?php if ($this->getSetting('download_tracking_pause') != NULL && $this->getSetting('download_tracking') == 1) { ?> woopra.config('download_pause', <?php echo $this->getSetting('download_tracking_pause'); ?>);<?php echo "\n"; } ?>
56
+ <?php if ($this->getSetting('outgoing_tracking') == 0) { ?> woopra.config('outgoing_tracking', false);<?php echo "\n"; } ?>
57
+ <?php if ($this->getSetting('outgoing_tracking_pause') != NULL && $this->getSetting('outgoing_tracking') == 1) { ?> woopra.config('outgoing_pause', <?php echo $this->getSetting('outgoing_tracking_pause'); ?>);<?php echo "\n"; } ?>
58
+ <?php if ($this->getSetting('hostname') != NULL) { ?> woopra.config('domain', '<?php echo $this->getSetting('hostname'); ?>');<?php echo "\n"; ?>
59
+ <?php } else { ?> woopra.config('domain', '<?php echo $this->getSetting('url'); ?>');<?php echo "\n"; } ?>
60
+ <?php if ($this->getSetting('visitor_timeout') != NULL) { ?> woopra.config('idle_timeout', <?php echo $this->getSetting('visitor_timeout') * 60 * 1000; ?>);<?php echo "\n"; ?>
61
+ <?php } else { ?> woopra.config('idle_timeout', 1800000);<?php echo "\n"; } ?>
62
+ <?php if ($this->getSetting('subdomain') != NULL) { ?> woopra.config(<?php echo $this->getSetting('subdomain'); ?>);<?php echo "\n"; } ?>
63
+ <?php if ($this->getSetting('customer_name') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerName(); ?>', '<?php echo $this->getSetting('customer_name'); ?>');<?php echo "\n"; } ?>
64
+ <?php if ($this->getSetting('customer_email') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerEmail(); ?>', '<?php echo $this->getSetting('customer_email'); ?>');<?php echo "\n"; } ?>
65
+ <?php if ($this->getSetting('customer_company') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerCompany(); ?>', '<?php echo $this->getSetting('customer_company'); ?>');<?php echo "\n"; } ?>
66
+ <?php if ($this->getSetting('customer_location') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerLocation(); ?>', '<?php echo $this->getSetting('customer_location'); ?>');<?php echo "\n"; } ?>
67
+ <?php if ($this->getSetting('customer_phone') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerPhone(); ?>', '<?php echo $this->getSetting('customer_phone'); ?>');<?php echo "\n"; } ?>
68
+ <?php if ($this->getSetting('customer_group') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerGroup(); ?>', '<?php echo $this->getSetting('customer_group'); ?>');<?php echo "\n"; } ?>
69
+ <?php if ($this->getSetting('customer_lifetime_sales') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerLifetimeSales(); ?>', '<?php echo $this->getSetting('customer_lifetime_sales'); ?>');<?php echo "\n"; } ?>
70
+ <?php if ($this->getSetting('customer_number_orders') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerNumberOrders(); ?>', '<?php echo $this->getSetting('customer_number_orders'); ?>');<?php echo "\n"; } ?>
71
+ <?php if ($this->getSetting('customer_create_date') != NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerCreateDate(); ?>', '<?php echo $this->getSetting('customer_create_date'); ?>');<?php echo "\n"; } ?>
72
+ <?php if ($this->getSetting('customer_cart_items') !== NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerCartItems(); ?>', '<?php echo $this->getSetting('customer_cart_items'); ?>');<?php echo "\n"; } ?>
73
+ <?php if ($this->getSetting('customer_cart_total') !== NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerCartTotal(); ?>', '<?php echo $this->getSetting('customer_cart_total'); ?>');<?php echo "\n"; } ?>
74
+ <?php if ($this->getSetting('customer_wishlist_items') !== NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerWishlistItems(); ?>', '<?php echo $this->getSetting('customer_wishlist_items'); ?>');<?php echo "\n"; } ?>
75
+ <?php if ($this->getSetting('customer_wishlist_total') !== NULL) { ?> woopra.identify('<?php echo Mage::helper('woopra')->getCustomerWishlistTotal(); ?>', '<?php echo $this->getSetting('customer_wishlist_total'); ?>');<?php echo "\n"; } ?>
76
+ <?php if ($this->getSetting('track_url_parameters') == 1) { ?> woopra.config('ignore_query_url', false);<?php echo "\n"; ?>
77
+ woopra.track('pv', {url: window.location.pathname+window.location.search, title: document.title});<?php echo "\n"; ?>
78
+ <?php } else { ?> woopra.track();<?php echo "\n"; } ?>
79
+ <?php if ($this->getSetting('woopra_cart_wishlist_trigger') == 1) { ?> woopra.track({<?php echo "\n";?>
80
  name: '<?php echo $this->getSetting('woopra_cart_wishlist_status'); ?>',
81
  product_name: '<?php echo $this->getSetting('woopra_cart_wishlist_name'); ?>',
82
  product_sku: '<?php echo $this->getSetting('woopra_cart_wishlist_sku'); ?>',
89
  product_tagged: '<?php echo $this->getSetting('woopra_product_tag_name'); ?>'<?php } ?>
90
  <?php } echo "\n";?>
91
  <?php echo " });\n"; } ?>
92
+ <?php if ($this->getSetting('woopra_subscriber_changed') == 1) { ?> woopra.track({<?php echo "\n";?>
93
  name: '<?php echo $this->getSetting('woopra_subscriber_status'); ?>',
94
  email: '<?php echo $this->getSetting('woopra_subscriber_email'); ?>'
95
  <?php echo " });\n"; } ?>
96
+ <?php if ($this->getSetting('woopra_contacts_index_post') == 1) { ?> woopra.track({<?php echo "\n";?>
97
  name: '<?php echo Mage::helper('woopra')->getContactFormSent(); ?>',
98
  customer_name: '<?php echo $this->getSetting('woopra_contacts_name'); ?>',
99
  customer_email: '<?php echo $this->getSetting('woopra_contacts_email'); ?>',
100
  customer_telephone: '<?php echo $this->getSetting('woopra_contacts_telephone'); ?>',
101
  customer_comment: '<?php echo $this->getSetting('woopra_contacts_comment'); ?>'
102
  <?php echo " });\n"; } ?>
103
+ <?php if ($this->getSetting('woopra_search_trigger') == 1) { ?> woopra.track({<?php echo "\n";?>
104
  name: '<?php echo Mage::helper('woopra')->getCatalogSearch(); ?>',
105
  keywords: '<?php echo $this->getSetting('woopra_search_keywords'); ?>'
106
  <?php echo " });\n"; } ?>
107
+ <?php if ($this->getSetting('woopra_cms_noroute_trigger') == 1) { ?> woopra.track({<?php echo "\n";?>
108
  name: '<?php echo Mage::helper('woopra')->getCmsNoRoute(); ?>',
109
  path: '<?php echo $this->getSetting('woopra_cms_noroute_path'); ?>',
110
  url: '<?php echo $this->getSetting('woopra_cms_noroute_url'); ?>'
111
  <?php echo " });\n"; } ?>
112
+ <?php if ($this->getSetting('woopra_forgot_password_trigger') == 1) { ?> woopra.track({<?php echo "\n";?>
113
  name: '<?php echo Mage::helper('woopra')->getForgotPassword(); ?>',
114
  email: '<?php echo $this->getSetting('woopra_forgot_password_email'); ?>'
115
  <?php echo " });\n"; } ?>
116
+ <?php if ($this->getSetting('woopra_estimate_post_trigger') == 1) { ?> woopra.track({<?php echo "\n";?>
117
  name: '<?php echo Mage::helper('woopra')->getEstimatePost(); ?>',
118
  country: '<?php echo $this->getSetting('woopra_estimate_post_country'); ?>',
119
  state: '<?php echo $this->getSetting('woopra_estimate_post_state'); ?>',
120
  zip: '<?php echo $this->getSetting('woopra_estimate_post_zip'); ?>'
121
  <?php echo " });\n"; } ?>
122
+ <?php if ($this->getSetting('woopra_password_changed_trigger') == 1) { ?> woopra.track({<?php echo "\n";?>
123
  name: '<?php echo Mage::helper('woopra')->getChangedPassword(); ?>'
124
  <?php echo " });\n"; } ?>
125
+ <?php if ($this->getSetting('woopra_create_account_trigger') == 1) { ?> woopra.track({<?php echo "\n";?>
126
  name: '<?php echo Mage::helper('woopra')->getCustomerCreateAccount(); ?>'
127
  <?php echo " });\n"; } ?>
128
+ <?php if ($this->getSetting('woopra_create_account_success_trigger') == 1) { ?> woopra.track({<?php echo "\n";?>
129
  name: '<?php echo Mage::helper('woopra')->getCustomerCreateAccountSuccess(); ?>'
130
  <?php echo " });\n"; } ?>
131
+ <?php if ($this->getSetting('woopra_poll_vote_trigger') == 1) { ?> woopra.track({<?php echo "\n";?>
132
  name: '<?php echo Mage::helper('woopra')->getPollVote(); ?>',
133
  poll_title: '<?php echo $this->getSetting('woopra_poll_vote_title'); ?>',
134
  poll_vote: '<?php echo $this->getSetting('woopra_poll_vote_answer'); ?>'
135
  <?php echo " });\n"; } ?>
136
+ <?php if ($this->getSetting('woopra_coupon_code_trigger') == 1) { ?> woopra.track({<?php echo "\n";?>
137
  name: '<?php echo $this->getSetting('woopra_coupon_code_status'); ?>',
138
  coupon_code: '<?php echo $this->getSetting('woopra_coupon_code'); ?>',
139
  coupon_code_active: '<?php echo $this->getSetting('woopra_coupon_code_active'); ?>',
140
  coupon_code_name: '<?php echo $this->getSetting('woopra_coupon_code_name'); ?>',
141
  coupon_code_validity: '<?php echo $this->getSetting('woopra_coupon_code_validity'); ?>'
142
  <?php echo " });\n"; } ?>
143
+ <?php if ($this->getSetting('woopra_login_logout_trigger') == 1) { ?> woopra.track({<?php echo "\n";?>
144
  name: '<?php echo $this->getSetting('woopra_login_logout_status'); ?>'
145
  <?php echo " });\n"; } ?>
146
+ <?php if ($this->getSetting('woopra_checkout_success_trigger') == 1) { ?> woopra.track({<?php echo "\n";?>
147
  name: '<?php echo Mage::helper('woopra')->getCheckoutSuccess(); ?>',
148
  <?php if ($this->getSetting('woopra_checkout_success_coupon_code') != NULL) { ?> coupon_code: '<?php echo $this->getSetting('woopra_checkout_success_coupon_code'); ?>',<?php echo "\n"; } ?>
149
  <?php if ($this->getSetting('woopra_checkout_success_discount_amount') != 0) { ?> discount_amount: '<?php echo $this->getSetting('woopra_checkout_success_discount_amount'); ?>',<?php echo "\n"; } ?>
158
  shipping_method: '<?php echo $this->getSetting('woopra_checkout_success_shipping_description'); ?>',
159
  total_items_ordered: '<?php echo $this->getSetting('woopra_checkout_success_total_items_ordered'); ?>'
160
  <?php echo " });\n"; } ?>
 
 
 
 
 
 
 
 
 
 
161
  </script>
162
 
163
  <?php if($this->getSetting('test')) { ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Woopra_Analytics_Event_And_Visitor_Tracking</name>
4
- <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -18,12 +18,16 @@ Access custom reports instantly. No more bugging IT. No old-school interfaces. N
18
  &lt;br /&gt;&#xD;
19
  &lt;a href="http://www.k3live.com/magento-extensions/magento-woopra-tracking"&gt;&lt;img src="http://www.magentocommerce.com/magento-connect/media/catalog/product/w/o/woopra_tracking_5_1_1.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&#xD;
20
  Note: This module will not work without a subscription to the &lt;a href="http://www.woopra.com/?woo_campaign=affiliate&amp;woo_medium=referral&amp;woo_source=k3live"&gt;Woopra&lt;/a&gt; service.</description>
21
- <notes>Updated reserved properties customer_name, customer_email, customer_company to name, email, company.&#xD;
22
- Moved page view track to before custom event track.</notes>
 
 
 
 
23
  <authors><author><name>Woopra</name><user>Woopra</user><email>support@k3live.com</email></author><author><name>K3Live</name><user>K3Live</user><email>support@k3live.com</email></author></authors>
24
- <date>2013-07-09</date>
25
- <time>23:04:02</time>
26
- <contents><target name="magecommunity"><dir><dir name="Woopra"><dir name="Analytics"><dir name="Block"><file name="Script.php" hash="a63b357f5c16bbed150b6bc3042b685a"/></dir><dir name="Helper"><file name="Data.php" hash="be8537fcc78c89b27604ac914f071e7b"/></dir><dir name="Model"><file name="Observer.php" hash="d0fa66a3110f759206bf39572fa10276"/></dir><dir name="etc"><file name="config.xml" hash="13020b9b9ee2dface0bd8a47bee08ca9"/><file name="system.xml" hash="df7c2385788799a7805889ffdaced707"/></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="woopra.xml" hash="2e2a05eaee9dc48e9aba6f24b66fd9e3"/></dir><dir name="template"><dir name="woopra"><file name="script.phtml" hash="93a56b728d139060084de667270bf74e"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Woopra_Analytics.xml" hash="a4715864833c0024017692871431cb91"/></dir></dir></target></contents>
27
  <compatible/>
28
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
29
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Woopra_Analytics_Event_And_Visitor_Tracking</name>
4
+ <version>1.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">Open Software License (OSL)</license>
7
  <channel>community</channel>
18
  &lt;br /&gt;&#xD;
19
  &lt;a href="http://www.k3live.com/magento-extensions/magento-woopra-tracking"&gt;&lt;img src="http://www.magentocommerce.com/magento-connect/media/catalog/product/w/o/woopra_tracking_5_1_1.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&#xD;
20
  Note: This module will not work without a subscription to the &lt;a href="http://www.woopra.com/?woo_campaign=affiliate&amp;woo_medium=referral&amp;woo_source=k3live"&gt;Woopra&lt;/a&gt; service.</description>
21
+ <notes>Updated javascript tracking code.&#xD;
22
+ Moved script to header, loads async, can capture tracking data if user navigates away before page load complete.&#xD;
23
+ Updated reserved properties (again) customer_name, customer_email, customer_company to name, email, company.&#xD;
24
+ Modified shopping cart and wishlist to send values even if empty in order to show correct values when everything is removed.&#xD;
25
+ Corrected undefined variables for wishlistItems and wishListTotal.&#xD;
26
+ Corrected undefined property for $_orderStateValue by adding setOrderStateFilter to $customerTotals, used when pulling Customer Lifetime data.</notes>
27
  <authors><author><name>Woopra</name><user>Woopra</user><email>support@k3live.com</email></author><author><name>K3Live</name><user>K3Live</user><email>support@k3live.com</email></author></authors>
28
+ <date>2013-07-30</date>
29
+ <time>05:44:30</time>
30
+ <contents><target name="magecommunity"><dir><dir name="Woopra"><dir name="Analytics"><dir name="Block"><file name="Script.php" hash="13b47ea6e19b2a7ecd2b5ab47e194cf0"/></dir><dir name="Helper"><file name="Data.php" hash="368415028736bb52bd2cffe4fb484f61"/></dir><dir name="Model"><file name="Observer.php" hash="d0fa66a3110f759206bf39572fa10276"/></dir><dir name="etc"><file name="config.xml" hash="fcf71436b2e0c8094afb8ea3a13fe24d"/><file name="system.xml" hash="6181e9cbc760b70323ed6136b4b68f5e"/></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="woopra.xml" hash="59e9f7587e22ae4a1afa80e01cc79d7b"/></dir><dir name="template"><dir name="woopra"><file name="script.phtml" hash="96b6477c0652d1082c235bd3dee993a5"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Woopra_Analytics.xml" hash="a4715864833c0024017692871431cb91"/></dir></dir></target></contents>
31
  <compatible/>
32
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
33
  </package>