IntileryAnalytics - Version 1.1.0

Version Notes

Support for Magento versions 1.9 to 1.9.2

Download this release

Release Info

Developer Gareth
Extension IntileryAnalytics
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.2 to 1.1.0

app/.DS_Store DELETED
Binary file
app/._.DS_Store DELETED
Binary file
app/code/local/Intilery/Analytics/Helper/Data.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
-
3
- class Intilery_Analytics_Helper_Data extends Mage_Core_Helper_Abstract {
4
- public function getSomeData() {
5
-
6
- }
7
- }
8
-
9
- ?>
 
 
 
 
 
 
 
 
 
app/code/local/Intilery/Analytics/Model/Observer.php CHANGED
@@ -3,7 +3,7 @@
3
  class Intilery_Analytics_Model_Observer {
4
 
5
  public function logProductView(Varien_Event_Observer $observer) {
6
-
7
  # Set intilery action
8
  Mage::getSingleton('core/session')->setData('intileryTagType', 'ProductView');
9
 
@@ -19,42 +19,28 @@ class Intilery_Analytics_Model_Observer {
19
 
20
  # Load category model
21
  $_category = Mage::getModel('catalog/category');
22
- $_category->load($categoryID);
23
 
24
- # Get the category name
25
  $categories[] = $_category->getName();
26
 
27
  # Clear up
28
  unset($_category);
29
 
30
  }
31
-
32
  # Store in the session
33
  Mage::getSingleton('core/session')->setData('productViewData', array(
34
  'id' => $product->getId(),
35
  'name' => $product->getName(),
36
- 'price' => $product->getPrice(),
37
  'sku' => $product->getSku(),
38
- 'image' => $product->getMediaConfig()->getMediaUrl($product->getData('image')),
39
  'description' => $product->getDescription(),
40
  'category' => implode(', ', $categories),
41
- 'categoryIds' => $product->getCategoryIds()
42
- )
43
- );
44
-
45
- }
46
-
47
- public function logCategoryView(Varien_Event_Observer $observer) {
48
-
49
- # Set intilery action
50
- Mage::getSingleton('core/session')->setData('intileryTagType', 'CategoryView');
51
-
52
- # Get the product
53
- $category = $observer->getCategory();
54
-
55
- # Store in the session
56
- Mage::getSingleton('core/session')->setData('categoryViewData', array(
57
- 'name' => $category->getName()
58
  )
59
  );
60
 
@@ -101,8 +87,7 @@ class Intilery_Analytics_Model_Observer {
101
  );
102
 
103
  }
104
-
105
-
106
  public function logCustomerRegister(Varien_Event_Observer $observer) {
107
 
108
  # Set intilery action
@@ -144,30 +129,32 @@ class Intilery_Analytics_Model_Observer {
144
  }
145
 
146
  public function logCartUpdate(Varien_Event_Observer $observer) {
147
-
148
- # Get product
149
- $quoteItem = $observer->getItem();
150
- $quantity = $quoteItem->getQty();
151
- $product = $quoteItem->getProduct();
152
-
153
- # Valid product?
154
- if(!$product->getId()) {
155
- return;
 
 
 
 
 
 
 
 
 
156
  }
157
-
158
  # Store in the session
159
- Mage::getSingleton('core/session')->setData('productUpdateShoppingCart', array(
160
- 'id' => $product->getId(),
161
- 'name' => $product->getName(),
162
- 'quantity' => $quantity,
163
- 'price' => $product->getPrice(),
164
- 'sku' => $product->getSku()
165
- )
166
- );
167
-
168
  # Set intilery action
169
  Mage::getSingleton('core/session')->setData('intileryTagType', 'UpdateCart');
170
-
171
  }
172
 
173
  public function logCartAdd(Varien_Event_Observer $observer) {
@@ -183,16 +170,21 @@ class Intilery_Analytics_Model_Observer {
183
  }
184
 
185
  # Get any categories
186
- $categories = $product->getCategoryIds();
187
-
 
 
 
188
  # Store in the session
189
  Mage::getSingleton('core/session')->setData('productInShoppingCart', array(
190
- 'id' => $product->getId(),
191
- 'quantity' => Mage::app()->getRequest()->getParam('qty', 1),
192
- 'name' => $product->getName(),
193
- 'price' => $product->getPrice(),
194
  'sku' => $product->getSku(),
 
195
  'category_name' => Mage::getModel('catalog/category')->load($categories[0])->getName(),
 
196
  )
197
  );
198
 
@@ -215,8 +207,11 @@ class Intilery_Analytics_Model_Observer {
215
  Mage::getSingleton('core/session')->setData('productOutShoppingCart', array(
216
  'id' => $product->getId(),
217
  'name' => $product->getName(),
218
- 'price' => $product->getPrice(),
219
- 'sku' => $product->getSku()
 
 
 
220
  )
221
  );
222
 
3
  class Intilery_Analytics_Model_Observer {
4
 
5
  public function logProductView(Varien_Event_Observer $observer) {
6
+
7
  # Set intilery action
8
  Mage::getSingleton('core/session')->setData('intileryTagType', 'ProductView');
9
 
19
 
20
  # Load category model
21
  $_category = Mage::getModel('catalog/category');
22
+ $_category->load($categoryID);
23
 
24
+ # Get the category name
25
  $categories[] = $_category->getName();
26
 
27
  # Clear up
28
  unset($_category);
29
 
30
  }
31
+
32
  # Store in the session
33
  Mage::getSingleton('core/session')->setData('productViewData', array(
34
  'id' => $product->getId(),
35
  'name' => $product->getName(),
36
+ 'price' => Mage::helper('core')->currency($product->getPrice(), true, false),
37
  'sku' => $product->getSku(),
38
+ 'image' => $product->getImage(),
39
  'description' => $product->getDescription(),
40
  'category' => implode(', ', $categories),
41
+ 'categoryIds' => $product->getCategoryIds(),
42
+ 'language' => Mage::app()->getLocale()->getLocaleCode(),
43
+ 'url' => $product->getProductUrl()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  )
45
  );
46
 
87
  );
88
 
89
  }
90
+
 
91
  public function logCustomerRegister(Varien_Event_Observer $observer) {
92
 
93
  # Set intilery action
129
  }
130
 
131
  public function logCartUpdate(Varien_Event_Observer $observer) {
132
+
133
+ $newQty = $observer->getEvent()->getInfo();
134
+ $newQty = array_values($newQty);
135
+
136
+ $cart = Mage::getModel('checkout/cart')->getQuote();
137
+ $updateCartArray = array();
138
+
139
+ foreach ($cart->getAllItems() as $key=>$item) {
140
+
141
+ if($newQty[$key]['qty'] != $item->getQty()){
142
+
143
+ $updateCartArray[] = array(
144
+ 'id' => $item->getProduct()->getId(),
145
+ 'quantity' => $newQty[$key]['qty']
146
+ );
147
+
148
+ }
149
+
150
  }
151
+
152
  # Store in the session
153
+ Mage::getSingleton('core/session')->setData('productUpdateShoppingCart', $updateCartArray);
154
+
 
 
 
 
 
 
 
155
  # Set intilery action
156
  Mage::getSingleton('core/session')->setData('intileryTagType', 'UpdateCart');
157
+
158
  }
159
 
160
  public function logCartAdd(Varien_Event_Observer $observer) {
170
  }
171
 
172
  # Get any categories
173
+ $categories = $product->getCategoryIds();
174
+
175
+ #GET CURRENCY CODE
176
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
177
+
178
  # Store in the session
179
  Mage::getSingleton('core/session')->setData('productInShoppingCart', array(
180
+ 'id' => $product->getId(),
181
+ 'quantity' => Mage::app()->getRequest()->getParam('qty', 1),
182
+ 'name' => $product->getName(),
183
+ 'price' => $currency_symbol = Mage::helper('core')->currency($product->getPrice(), true, false),
184
  'sku' => $product->getSku(),
185
+ 'language' => Mage::app()->getLocale()->getLocaleCode(),
186
  'category_name' => Mage::getModel('catalog/category')->load($categories[0])->getName(),
187
+ 'url' => $product->getProductUrl()
188
  )
189
  );
190
 
207
  Mage::getSingleton('core/session')->setData('productOutShoppingCart', array(
208
  'id' => $product->getId(),
209
  'name' => $product->getName(),
210
+ 'price' => Mage::helper('core')->currency($product->getPrice(), true, false),
211
+ 'sku' => $product->getSku(),
212
+ 'qty'=> $observer->getQuoteItem()->getQty(),
213
+ 'language'=> Mage::app()->getLocale()->getLocaleCode(),
214
+ 'url' => $product->getProductUrl()
215
  )
216
  );
217
 
app/code/local/Intilery/Analytics/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Intilery_Analytics>
5
- <version>1.0.0</version>
6
  </Intilery_Analytics>
7
  </modules>
8
 
@@ -12,7 +12,6 @@
12
  <class>Intilery_Analytics_Model</class>
13
  </analytics>
14
  </models>
15
-
16
  <helpers>
17
  <analytics>
18
  <class>Intilery_Analytics_Helper</class>
@@ -23,47 +22,61 @@
23
  </helpers>
24
 
25
  <events>
26
- <!-- <catalog_product_save_after>
27
  <observers>
28
  <analytics>
29
  <class>analytics/observer</class>
30
- <method>logUpdate</method>
31
  <type>singleton</type>
32
  </analytics>
33
  </observers>
34
- </catalog_product_save_after> -->
35
-
36
- <checkout_cart_add_product_complete>
37
- <observers>
38
- <analytics_cart_add>
39
- <class>analytics/observer</class>
40
- <method>logCartAdd</method>
41
- <type>singleton</type>
42
- </analytics_cart_add>
43
- </observers>
44
- </checkout_cart_add_product_complete>
45
-
46
- <sales_quote_item_qty_set_after>
47
- <observers>
48
- <analytics_cart_update>
49
- <class>analytics/observer</class>
50
- <method>logCartUpdate</method>
51
- <type>singleton</type>
52
- </analytics_cart_update>
53
- </observers>
54
- </sales_quote_item_qty_set_after>
55
-
56
- <!--
57
- <checkout_cart_update_item_complete>
58
- <observers>
59
- <analytics_cart_update>
60
- <class>analytics/observer</class>
61
- <method>logCartUpdate</method>
62
- <type>singleton</type>
63
- </analytics_cart_update>
64
- </observers>
65
- </checkout_cart_update_item_complete>
66
- -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  <sales_quote_remove_item>
69
  <observers>
@@ -74,6 +87,8 @@
74
  </analytics_cart_remove>
75
  </observers>
76
  </sales_quote_remove_item>
 
 
77
 
78
  <customer_logout>
79
  <observers>
@@ -84,6 +99,8 @@
84
  </analytics_logout>
85
  </observers>
86
  </customer_logout>
 
 
87
 
88
  <customer_login>
89
  <observers>
@@ -94,7 +111,9 @@
94
  </analytics_login>
95
  </observers>
96
  </customer_login>
97
-
 
 
98
  <customer_register_success>
99
  <observers>
100
  <analytics_register>
@@ -105,7 +124,7 @@
105
  </observers>
106
  </customer_register_success>
107
 
108
- <catalogsearch_query_load_after>
109
  <observers>
110
  <analytics_search>
111
  <class>analytics/observer</class>
@@ -114,16 +133,8 @@
114
  </analytics_search>
115
  </observers>
116
  </catalogsearch_query_load_after>
117
-
118
- <catalog_controller_category_init_after>
119
- <observers>
120
- <analytics_search>
121
- <class>analytics/observer</class>
122
- <method>logCategoryView</method>
123
- <type>singleton</type>
124
- </analytics_search>
125
- </observers>
126
- </catalog_controller_category_init_after>
127
 
128
  <catalog_controller_product_view>
129
  <observers>
@@ -134,6 +145,7 @@
134
  </analytics_product>
135
  </observers>
136
  </catalog_controller_product_view>
 
137
  </events>
138
  </global>
139
 
2
  <config>
3
  <modules>
4
  <Intilery_Analytics>
5
+ <version>1.1.0</version>
6
  </Intilery_Analytics>
7
  </modules>
8
 
12
  <class>Intilery_Analytics_Model</class>
13
  </analytics>
14
  </models>
 
15
  <helpers>
16
  <analytics>
17
  <class>Intilery_Analytics_Helper</class>
22
  </helpers>
23
 
24
  <events>
25
+ <!--<catalog_product_save_after>
26
  <observers>
27
  <analytics>
28
  <class>analytics/observer</class>
29
+ <method>logCartUpdate</method>
30
  <type>singleton</type>
31
  </analytics>
32
  </observers>
33
+ </catalog_product_save_after>-->
34
+
35
+ <!--ADD CART ITEM-->
36
+
37
+ <checkout_cart_add_product_complete>
38
+ <observers>
39
+ <analytics_cart_add>
40
+ <class>analytics/observer</class>
41
+ <method>logCartAdd</method>
42
+ <type>singleton</type>
43
+ </analytics_cart_add>
44
+ </observers>
45
+ </checkout_cart_add_product_complete>
46
+
47
+ <checkout_cart_product_add_before>
48
+ <observers>
49
+ <analytics_cart_add>
50
+ <class>analytics/observer</class>
51
+ <method>logCartAdd</method>
52
+ <type>singleton</type>
53
+ </analytics_cart_add>
54
+ </observers>
55
+ </checkout_cart_product_add_before>
56
+
57
+ <checkout_cart_product_add_after>
58
+ <observers>
59
+ <analytics_cart_add>
60
+ <class>analytics/observer</class>
61
+ <method>logCartAdd</method>
62
+ <type>singleton</type>
63
+ </analytics_cart_add>
64
+ </observers>
65
+ </checkout_cart_product_add_after>
66
+
67
+ <!--UPDATE CART ITEM-->
68
+
69
+ <checkout_cart_update_items_before>
70
+ <observers>
71
+ <analytics_cart_add>
72
+ <class>analytics/observer</class>
73
+ <method>logCartUpdate</method>
74
+ <type>singleton</type>
75
+ </analytics_cart_add>
76
+ </observers>
77
+ </checkout_cart_update_items_before>
78
+
79
+ <!--REMOVE CART ITEM-->
80
 
81
  <sales_quote_remove_item>
82
  <observers>
87
  </analytics_cart_remove>
88
  </observers>
89
  </sales_quote_remove_item>
90
+
91
+ <!--LOGOUT-->
92
 
93
  <customer_logout>
94
  <observers>
99
  </analytics_logout>
100
  </observers>
101
  </customer_logout>
102
+
103
+ <!--LOGIN-->
104
 
105
  <customer_login>
106
  <observers>
111
  </analytics_login>
112
  </observers>
113
  </customer_login>
114
+
115
+ <!--REGISTER ACCOUNT-->
116
+
117
  <customer_register_success>
118
  <observers>
119
  <analytics_register>
124
  </observers>
125
  </customer_register_success>
126
 
127
+ <catalogsearch_query_load_after>
128
  <observers>
129
  <analytics_search>
130
  <class>analytics/observer</class>
133
  </analytics_search>
134
  </observers>
135
  </catalogsearch_query_load_after>
136
+
137
+ <!--VIEW PRODUCT-->
 
 
 
 
 
 
 
 
138
 
139
  <catalog_controller_product_view>
140
  <observers>
145
  </analytics_product>
146
  </observers>
147
  </catalog_controller_product_view>
148
+
149
  </events>
150
  </global>
151
 
app/design/.DS_Store DELETED
Binary file
app/design/._.DS_Store DELETED
Binary file
app/design/frontend/.DS_Store DELETED
Binary file
app/design/frontend/._.DS_Store DELETED
Binary file
app/design/frontend/base/.DS_Store DELETED
Binary file
app/design/frontend/base/._.DS_Store DELETED
Binary file
app/design/frontend/base/default/.DS_Store DELETED
Binary file
app/design/frontend/base/default/._.DS_Store DELETED
Binary file
app/design/frontend/base/default/template/.DS_Store DELETED
Binary file
app/design/frontend/base/default/template/._.DS_Store DELETED
Binary file
app/design/frontend/base/default/template/intilery/footer.phtml CHANGED
@@ -6,18 +6,23 @@ $intileryConfig = Mage::getStoreConfig('intilery/tracking');
6
  # Enabled tracking?
7
  if($intileryConfig['active']) {
8
 
9
- # Main tracking tag
10
- echo '
11
- <script type="text/javascript">
12
- _gaq = [] || _gaq;window.INTILERY = {};INTILERY.gaq = [];
13
- (function($, _push) {_gaqPush = _push;$.push = function() {INTILERY.gaq.push(arguments[0]);return _gaqPush.apply(_gaq,arguments);}})(_gaq, _gaq.push);var _itq = _itq || [];
14
- _itq.push(["_setAccount", "'.$intileryConfig['code'].'"]);
15
- (function(){
16
- var it = document.createElement("script"); it.type = "text/javascript"; it.async = true;
17
- it.src = ("https:" == document.location.protocol ? "https://" : "http://") + "www.intilery-analytics.com/rest/it.js";
18
- var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(it, s);
19
- })();
20
- </script>';
 
 
 
 
 
21
 
22
  # Get any triggered events
23
  $intileryTagType = Mage::getSingleton('core/session')->getData('intileryTagType', true);
@@ -33,16 +38,18 @@ _itq.push(["_setAccount", "'.$intileryConfig['code'].'"]);
33
 
34
  if(!is_null($customerRegisterData) && !empty($customerRegisterData)) {
35
 
36
- echo "<script>
37
- var _itq = _itq || [];
 
38
  _itq.push(['_trackUserEvent','register account',
39
  [
40
- {name:'Customer.Email', value:'{$customerRegisterData['email']}'},
41
- {name:'Customer.First Name', value:\"{$customerRegisterData['forename']}\"},
42
- {name:'Customer.Last Name', value:\"{$customerRegisterData['surname']}\"},
43
- {name:'Customer.Subscribed', value:'{$customerRegisterData['subscribe']}'}
44
  ]]);
45
- </script>";
 
46
 
47
  }
48
 
@@ -53,138 +60,188 @@ _itq.push(["_setAccount", "'.$intileryConfig['code'].'"]);
53
 
54
  # Login customer
55
  if($intileryTagType == 'CustomerLogin') {
 
 
56
 
57
  # Any "add to cart" data
58
  $customerLoginData = Mage::getSingleton('core/session')->getData('customerLogin', true);
59
 
60
  # Did we add to cart?
61
  if(!is_null($customerLoginData) && !empty($customerLoginData)) {
62
-
63
- echo "<script>
64
- var _itq = _itq || [];
65
- _itq.push(['_trackUserEvent', 'sign in', [{name:'Customer.Email', value:'{$customerLoginData['email']}'}]]);
66
- </script>";
67
-
 
68
  }
 
69
 
70
  # Logout customer
71
  } elseif($intileryTagType == 'CustomerLogout') {
72
-
73
- echo "<script>
74
- var _itq = _itq || [];
75
- _itq.push(['_trackUserEvent', 'sign out', []]);
76
- </script>";
 
 
 
 
 
 
 
 
77
 
78
  # When we added to cart
79
  } elseif($intileryTagType == 'AddCart') {
80
 
 
 
81
  # Any "add to cart" data
82
  $productAddedToCart = Mage::getSingleton('core/session')->getData('productInShoppingCart', true);
83
 
84
  # Did we add to cart?
85
  if(!is_null($productAddedToCart) && !empty($productAddedToCart)) {
86
-
87
- echo "<script>
88
- var _itq = _itq || [];
89
- _itq.push(['_trackUserEvent', 'add to basket', [
90
- {name:'Add To Basket.SKU', value:'{$productAddedToCart['sku']}'},
91
- {name:'Add To Basket.Quantity', value:'{$productAddedToCart['quantity']}'},
92
- {name:'Add To Basket.Price', value:'{$productAddedToCart['price']}'},
93
- {name:'Product.Name', value:\"{$productAddedToCart['name']}\"}
94
- ], 'Add To Basket']);
95
- </script>";
96
-
 
 
 
 
 
 
 
 
97
  }
 
 
98
 
99
  } elseif($intileryTagType == 'RemoveCart') {
 
 
100
 
101
  # Any "add to cart" data
102
  $productRemovedFromCart = Mage::getSingleton('core/session')->getData('productOutShoppingCart', true);
103
 
104
  # Did we add to cart?
105
  if(!is_null($productRemovedFromCart) && !empty($productRemovedFromCart)) {
106
-
107
- echo "<script>
108
- var _itq = _itq || [];
109
- _itq.push(['_trackUserEvent', 'remove from basket', [
110
- {name:'Product.Name',value:\"{$productRemovedFromCart['name']}\"}
111
- ], 'Remove From Basket']);
112
- </script>";
113
-
 
 
 
 
 
114
  }
115
 
 
 
116
  } elseif($intileryTagType == 'UpdateCart') {
117
-
 
 
118
  # Any "update sale item cart" data
119
  $productUpdatedInCart = Mage::getSingleton('core/session')->getData('productUpdateShoppingCart', true);
120
 
121
  # Did we add to cart?
122
- if(!is_null($productUpdatedInCart) && !empty($productUpdatedInCart)) {
123
-
124
- echo "<script>
125
- var _itq = _itq || [];
126
- _itq.push(['_trackUserEvent', 'update basket', [
127
- {name:'Update Basket.Quantity', value:'{$productUpdatedInCart['quantity']}'},
128
- {name:'Update Basket.Price', value:'{$productUpdatedInCart['price']}'},
129
- {name:'Product.Name', value:\"{$productUpdatedInCart['name']}\"}
130
- ], 'Update Basket']);
131
- </script>";
132
-
 
 
 
 
 
133
  }
 
 
134
 
135
  } elseif($intileryTagType == 'Search') {
136
-
 
 
137
  # Any "update sale item cart" data
138
  $searchQueryText = Mage::getSingleton('core/session')->getData('searchQuery', true);
139
 
140
  # Did we add to cart?
141
  if(!is_null($searchQueryText) && !empty($searchQueryText)) {
142
 
143
- echo "<script>
144
- var _itq = _itq || [];
145
- _itq.push(['_trackUserEvent', 'Search', [{name:'Search.Term',value:\"{$searchQueryText}\"}]]);
146
- </script>";
147
-
 
 
 
 
 
 
148
  }
 
 
149
 
150
- } elseif($intileryTagType == 'ProductView') {
 
 
151
 
152
  # Get the product data
153
  $productViewData= Mage::getSingleton('core/session')->getData('productViewData', true);
154
 
155
  # Did we add to cart?
156
  if(!is_null($productViewData) && !empty($productViewData)) {
157
-
158
- echo "<script>
159
- var _itq = _itq || [];
160
- _itq.push(['_trackUserEvent', 'view product', [
161
- {name:'Product.Name', value: \"{$productViewData['name']}\"},
162
- {name:'Product.Price', value: '{$productViewData['price']}'},
163
- {name:'Product.Description', value: \"{$productViewData['description']}\"},
164
- {name:'Product.Image', value: '{$productViewData['image']}'},
165
- {name:'Product.Category', value: \"{$productViewData['category']}\"}
166
- ], 'View Product']);
167
- </script>";
168
-
 
 
 
 
 
 
 
 
 
 
 
169
  }
 
 
170
 
171
- } elseif($intileryTagType == 'CategoryView') {
172
-
173
- # Get the product data
174
- $categoryViewData= Mage::getSingleton('core/session')->getData('categoryViewData', true);
175
-
176
- # Did we add to cart?
177
- if(!is_null($categoryViewData) && !empty($categoryViewData)) {
178
-
179
- echo "<script>
180
- var _itq = _itq || [];
181
- _itq.push(['_trackUserEvent', 'view category', [
182
- {name:'Category.Name', value: \"{$categoryViewData['name']}\"}
183
- ], 'View Category']);
184
- </script>";
185
-
186
- }
187
-
188
  }
189
 
190
  }
6
  # Enabled tracking?
7
  if($intileryConfig['active']) {
8
 
9
+ ?>
10
+ <script type="text/javascript">
11
+ window.INTILERY = {};
12
+ INTILERY.gaq = [];
13
+ var _itq = _itq || [];
14
+ _itq.push(["_setAccount", "<?=$intileryConfig['code']?>"]);
15
+ (function () {
16
+ var it = document.createElement("script");
17
+ it.type = "text/javascript";
18
+ it.async = true;
19
+ it.src = ("https:" == document.location.protocol ? "https://" : "http://") + "www.intilery-analytics.com/rest/it.js";
20
+ var s = document.getElementsByTagName("script")[0];
21
+ s.parentNode.insertBefore(it, s);
22
+ })();
23
+ </script>
24
+
25
+ <?php
26
 
27
  # Get any triggered events
28
  $intileryTagType = Mage::getSingleton('core/session')->getData('intileryTagType', true);
38
 
39
  if(!is_null($customerRegisterData) && !empty($customerRegisterData)) {
40
 
41
+ ?>
42
+ <script>
43
+ var _itq = _itq || [];
44
  _itq.push(['_trackUserEvent','register account',
45
  [
46
+ {"name":"Customer.Email", "value":"<?=$customerRegisterData['email']?>"},
47
+ {"name":"Customer.First Name", "value":"<?=$customerRegisterData['forename']?>"},
48
+ {"name":"Customer.Last Name", "value":"<?=$customerRegisterData['surname']?>"},
49
+ {"name":"Customer.Subscribed", "value":"<?=$customerRegisterData['subscribe']?>"}
50
  ]]);
51
+ </script>
52
+ <?php
53
 
54
  }
55
 
60
 
61
  # Login customer
62
  if($intileryTagType == 'CustomerLogin') {
63
+
64
+ // <editor-fold desc="Customer Login">
65
 
66
  # Any "add to cart" data
67
  $customerLoginData = Mage::getSingleton('core/session')->getData('customerLogin', true);
68
 
69
  # Did we add to cart?
70
  if(!is_null($customerLoginData) && !empty($customerLoginData)) {
71
+
72
+ ?>
73
+ <script>
74
+ var _itq = _itq || [];
75
+ _itq.push(['_trackUserEvent', 'sign in', []]);
76
+ </script>
77
+ <?php
78
  }
79
+ // </editor-fold>
80
 
81
  # Logout customer
82
  } elseif($intileryTagType == 'CustomerLogout') {
83
+
84
+ // <editor-fold desc="Customer Logout">
85
+
86
+ ?>
87
+
88
+ <script>
89
+ var _itq = _itq || [];
90
+ _itq.push(['_trackUserEvent', 'sign out', []]);
91
+ </script>
92
+
93
+ <?php
94
+
95
+ // </editor-fold>
96
 
97
  # When we added to cart
98
  } elseif($intileryTagType == 'AddCart') {
99
 
100
+ // <editor-fold desc="Add Cart">
101
+
102
  # Any "add to cart" data
103
  $productAddedToCart = Mage::getSingleton('core/session')->getData('productInShoppingCart', true);
104
 
105
  # Did we add to cart?
106
  if(!is_null($productAddedToCart) && !empty($productAddedToCart)) {
107
+ ?>
108
+
109
+ <script>
110
+ var _itq = _itq || [];
111
+ _itq.push(["_trackUserEvent", "add to basket",
112
+ [
113
+ {"name":"Add To Basket.Price","value":"<?=$productAddedToCart['price']?>"},
114
+ {"name":"Add To Basket.Quantity","value":"<?=$productAddedToCart['quantity']?>"},
115
+ {"name":"Local Product.ID","value":"<?=$productAddedToCart['id']?>"},
116
+ {"name":"Local Product.Language","value":"<?=$productAddedToCart['language']?>"},
117
+ {"name":"Local Product.Link","value":"<?=$productAddedToCart['url']?>"},
118
+ {"name":"Local Product.Name","value":"<?=$productAddedToCart['name']?>"},
119
+ {"name":"Local Product.Price","value":"<?=$productAddedToCart['price']?>"}
120
+ ],
121
+ "Add To Basket"
122
+ ]);
123
+
124
+ </script>
125
+ <?php
126
  }
127
+
128
+ // </editor-fold>
129
 
130
  } elseif($intileryTagType == 'RemoveCart') {
131
+
132
+ //<editor-fold desc="Remove Cart">
133
 
134
  # Any "add to cart" data
135
  $productRemovedFromCart = Mage::getSingleton('core/session')->getData('productOutShoppingCart', true);
136
 
137
  # Did we add to cart?
138
  if(!is_null($productRemovedFromCart) && !empty($productRemovedFromCart)) {
139
+ ?>
140
+ <script>
141
+ var _itq = _itq || [];
142
+ _itq.push(["_trackUserEvent", "remove from basket", [
143
+     {"name":"Remove From Basket.Quantity","value":"<?=$productRemovedFromCart['qty']?>"},
144
+ {"name":"Local Product.ID","value":"<?=$productRemovedFromCart['id']?>"},
145
+ {"name":"Local Product.Language","value":"<?=$productRemovedFromCart['language']?>"},
146
+ {"name":"Local Product.Link","value":"<?=$productRemovedFromCart['url']?>"},
147
+ {"name":"Local Product.Name","value":"<?=$productRemovedFromCart['name']?>"},
148
+ {"name":"Local Product.Price","value":"<?=$productRemovedFromCart['price']?>"}
149
+ ], "Remove From Basket"]);
150
+ </script>
151
+ <?php
152
  }
153
 
154
+ // </editor-fold>
155
+
156
  } elseif($intileryTagType == 'UpdateCart') {
157
+
158
+ // <editor-fold desc="Update Cart">
159
+
160
  # Any "update sale item cart" data
161
  $productUpdatedInCart = Mage::getSingleton('core/session')->getData('productUpdateShoppingCart', true);
162
 
163
  # Did we add to cart?
164
+ if(!is_null($productUpdatedInCart) && !empty($productUpdatedInCart) && is_array($productUpdatedInCart) && sizeof($productUpdatedInCart) > 0) {
165
+
166
+ foreach($productUpdatedInCart as $product){
167
+ ?>
168
+ <script>
169
+ _itq.push(["_trackUserEvent", "Update Basket Quantity",
170
+ [
171
+ {"name":"Update Basket.Quantity","value":"<?=$product['quantity']?>"},
172
+ {"name":"Product.ID","value":"<?=$product['id']?>"}
173
+ ],
174
+ "Update Basket"
175
+ ]);
176
+ </script>
177
+ <?php
178
+ }
179
+
180
  }
181
+
182
+ // </editor-fold>
183
 
184
  } elseif($intileryTagType == 'Search') {
185
+
186
+ // <editor-fold desc="Search">
187
+
188
  # Any "update sale item cart" data
189
  $searchQueryText = Mage::getSingleton('core/session')->getData('searchQuery', true);
190
 
191
  # Did we add to cart?
192
  if(!is_null($searchQueryText) && !empty($searchQueryText)) {
193
 
194
+ ?>
195
+ <script>
196
+ _itq.push(["_trackUserEvent", "search",
197
+ [
198
+ {"name":"Search.Text","value":"<?=$searchQueryText?>"},
199
+ {"name":"_brand","value":"brand"}
200
+ ],
201
+ "Search"
202
+ ]);
203
+ </script>
204
+ <?php
205
  }
206
+
207
+ // </editor-fold>
208
 
209
+ } elseif($intileryTagType == 'ProductView') {
210
+
211
+ // <editor-fold desc="Product View">
212
 
213
  # Get the product data
214
  $productViewData= Mage::getSingleton('core/session')->getData('productViewData', true);
215
 
216
  # Did we add to cart?
217
  if(!is_null($productViewData) && !empty($productViewData)) {
218
+
219
+ ?>
220
+ <script>
221
+ var _itq = _itq || [];
222
+ _itq.push(["_trackUserEvent", "view product",
223
+ [
224
+ {"name":"View Product.Price","value":"<?=$productViewData['price']?>"},
225
+ {"name":"Local Product.ID","value":"<?=$productViewData['id']?>"},
226
+ {"name":"Local Product.Image","value":"<?=$productViewData['image']?>"},
227
+ {"name":"Local Product.Language","value":"<?=$productViewData['language']?>"},
228
+ {"name":"Local Product.Link","value":"<?=$productViewData['url']?>"},
229
+ {"name":"Local Product.Name","value":"<?=$productViewData['name']?>"},
230
+ {"name":"Local Product.Price","value":"<?=$productViewData['price']?>"},
231
+ {"name":"Local Product.RRP Price","value":"<?=$productViewData['price']?>"},
232
+ {"name":"Product.ID","value":"<?=$productViewData['id']?>"},
233
+ {"name":"Category.ID","value":"<?=$productViewData['categoryIds']?>"}
234
+ ],
235
+ "View Product"
236
+ ]);
237
+ </script>
238
+
239
+ <?php
240
+
241
  }
242
+
243
+ // </editor-fold>
244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  }
246
 
247
  }
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>IntileryAnalytics</name>
4
- <version>1.0.2</version>
5
  <stability>stable</stability>
6
- <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Install Intilery analytics on your Magento copy</summary>
10
- <description>Allows the user to connect their Magento installation with their Intilery tracking dashboard.</description>
11
- <notes>First preview release</notes>
12
- <authors><author><name>Lewis Theobald</name><user>LewisTheobald</user><email>lewis@aljtmedia.com</email></author></authors>
13
- <date>2014-02-27</date>
14
- <time>17:05:15</time>
15
- <contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="intilery"><file name="footer.phtml" hash="56156ecc00b3a43e2da8f416d40e36ca"/></dir></dir><dir name="layout"><file name="intileryanalytics.xml" hash="6f8d7b5aed8d4fa54ab6f4b9cb2a453d"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Intilery"><dir name="Analytics"><dir name="Helper"><file name="Data.php" hash="7875f3486d0bb7edbccc8ef2d41ee006"/></dir><dir name="Model"><file name="Observer.php" hash="fb9cb912eeaa9dca3c243eca7728e835"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a6eb6b0d6eaca7f0c086f5dd0ff8d85e"/><file name="config.xml" hash="c4cb5f38b309ae1cc54692ca5944e603"/><file name="system.xml" hash="c33bbe5c89fb09e0ac6665ef63e705b6"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Intilery_Analytics.xml" hash="943756b51b7a8bab8175c9132a7473c8"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>IntileryAnalytics</name>
4
+ <version>1.1.0</version>
5
  <stability>stable</stability>
6
+ <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Intilery Customer Engagement Connector edited to support Magento versions 1.9 upwards.</summary>
10
+ <description>Intilery Customer Engagement Connector allows you to connect Magento with Intilery.com seamlessly.</description>
11
+ <notes>Support for Magento versions 1.9 to 1.9.2</notes>
12
+ <authors><author><name>Gareth</name><user>intilery</user><email>gareth.james@intilery.com</email></author></authors>
13
+ <date>2015-10-16</date>
14
+ <time>12:22:13</time>
15
+ <contents><target name="magelocal"><dir name="Intilery"><dir name="Analytics"><dir name="Model"><file name="Observer.php" hash="f4ac9b6c4ace3c761d49dfe555b542b1"/></dir><dir name="etc"><file name="config.xml" hash="3149fd3538d7da8eeadc33acfcb5a09d"/><file name="adminhtml.xml" hash="a6eb6b0d6eaca7f0c086f5dd0ff8d85e"/><file name="system.xml" hash="c33bbe5c89fb09e0ac6665ef63e705b6"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="intilery"><file name="footer.phtml" hash="da29397069e675c74ed07cf10b6c0d5a"/></dir></dir><dir name="layout"><file name="intileryanalytics.xml" hash="6f8d7b5aed8d4fa54ab6f4b9cb2a453d"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Intilery_Analytics.xml" hash="943756b51b7a8bab8175c9132a7473c8"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>