analytics - Version 1.0.0

Version Notes

Download this release

Release Info

Developer Segment
Extension analytics
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (73) hide show
  1. app/.DS_Store +0 -0
  2. app/code/.DS_Store +0 -0
  3. app/code/community/.DS_Store +0 -0
  4. app/code/community/Segment/Analytics/Block/Json.php +37 -0
  5. app/code/community/Segment/Analytics/Block/Template.php +43 -0
  6. app/code/community/Segment/Analytics/Helper/Data.php +146 -0
  7. app/code/community/Segment/Analytics/Model/Controller/Addedtowishlist.php +23 -0
  8. app/code/community/Segment/Analytics/Model/Controller/Addtocart.php +8 -0
  9. app/code/community/Segment/Analytics/Model/Controller/Alias.php +17 -0
  10. app/code/community/Segment/Analytics/Model/Controller/Amlistfav.php +12 -0
  11. app/code/community/Segment/Analytics/Model/Controller/Base.php +82 -0
  12. app/code/community/Segment/Analytics/Model/Controller/Customerloggedin.php +15 -0
  13. app/code/community/Segment/Analytics/Model/Controller/Customerloggedout.php +17 -0
  14. app/code/community/Segment/Analytics/Model/Controller/Customerregistered.php +11 -0
  15. app/code/community/Segment/Analytics/Model/Controller/Filteredproducts.php +8 -0
  16. app/code/community/Segment/Analytics/Model/Controller/Identity.php +50 -0
  17. app/code/community/Segment/Analytics/Model/Controller/Init.php +8 -0
  18. app/code/community/Segment/Analytics/Model/Controller/Layerednavfilter.php +14 -0
  19. app/code/community/Segment/Analytics/Model/Controller/Orderplaced.php +38 -0
  20. app/code/community/Segment/Analytics/Model/Controller/Page.php +73 -0
  21. app/code/community/Segment/Analytics/Model/Controller/Removefromcart.php +8 -0
  22. app/code/community/Segment/Analytics/Model/Controller/Reviewedproduct.php +13 -0
  23. app/code/community/Segment/Analytics/Model/Controller/Searchedproducts.php +8 -0
  24. app/code/community/Segment/Analytics/Model/Controller/Subscribenewsletter.php +8 -0
  25. app/code/community/Segment/Analytics/Model/Controller/Viewedproduct.php +15 -0
  26. app/code/community/Segment/Analytics/Model/Controller/Viewedreviews.php +24 -0
  27. app/code/community/Segment/Analytics/Model/Front/Controller.php +130 -0
  28. app/code/community/Segment/Analytics/Model/Observer.php +337 -0
  29. app/code/community/Segment/Analytics/Model/Observer/Admin.php +40 -0
  30. app/code/community/Segment/Analytics/Model/Observer/Customer.php +53 -0
  31. app/code/community/Segment/Analytics/Model/Observer/Layered.php +28 -0
  32. app/code/community/Segment/Analytics/Model/Observer/Review.php +25 -0
  33. app/code/community/Segment/Analytics/Model/Query/.DS_Store +0 -0
  34. app/code/community/Segment/Analytics/Model/Query/Totalpurchased.php +17 -0
  35. app/code/community/Segment/Analytics/Model/Query/Totalspent.php +17 -0
  36. app/code/community/Segment/Analytics/Model/Resource/Setup.php +5 -0
  37. app/code/community/Segment/Analytics/Model/Session.php +12 -0
  38. app/code/community/Segment/Analytics/controllers/IndexController.php +8 -0
  39. app/code/community/Segment/Analytics/etc/adminhtml.xml +21 -0
  40. app/code/community/Segment/Analytics/etc/config.xml +330 -0
  41. app/code/community/Segment/Analytics/etc/system.xml +37 -0
  42. app/code/community/Segment/Analytics/sql/segment_analytics_setup/install-0.0.2.php +17 -0
  43. app/code/community/Segment/Analytics/sql/segment_analytics_setup/upgrade-0.0.2-0.0.3.php +21 -0
  44. app/design/.DS_Store +0 -0
  45. app/design/adminhtml/default/default/template/segment_analytics/welcome-container.phtml +6 -0
  46. app/design/adminhtml/default/default/template/segment_analytics/welcome.phtml +4 -0
  47. app/design/frontend/.DS_Store +0 -0
  48. app/design/frontend/base/.DS_Store +0 -0
  49. app/design/frontend/base/default/template/segment_analytics/addedtowishlist.phtml +7 -0
  50. app/design/frontend/base/default/template/segment_analytics/addtocart.phtml +5 -0
  51. app/design/frontend/base/default/template/segment_analytics/alias.phtml +4 -0
  52. app/design/frontend/base/default/template/segment_analytics/amlistfav.phtml +6 -0
  53. app/design/frontend/base/default/template/segment_analytics/customerloggedin.phtml +5 -0
  54. app/design/frontend/base/default/template/segment_analytics/customerloggedout.phtml +5 -0
  55. app/design/frontend/base/default/template/segment_analytics/customerregistered.phtml +4 -0
  56. app/design/frontend/base/default/template/segment_analytics/filteredproducts.phtml +6 -0
  57. app/design/frontend/base/default/template/segment_analytics/identity.phtml +17 -0
  58. app/design/frontend/base/default/template/segment_analytics/image-frontend.phtml +23 -0
  59. app/design/frontend/base/default/template/segment_analytics/init.phtml +6 -0
  60. app/design/frontend/base/default/template/segment_analytics/layerednavfilter.phtml +6 -0
  61. app/design/frontend/base/default/template/segment_analytics/orderplaced.phtml +6 -0
  62. app/design/frontend/base/default/template/segment_analytics/page.phtml +11 -0
  63. app/design/frontend/base/default/template/segment_analytics/removefromcart.phtml +5 -0
  64. app/design/frontend/base/default/template/segment_analytics/review-frontend.phtml +29 -0
  65. app/design/frontend/base/default/template/segment_analytics/reviewedproduct.phtml +6 -0
  66. app/design/frontend/base/default/template/segment_analytics/searchedproducts.phtml +7 -0
  67. app/design/frontend/base/default/template/segment_analytics/share-frontend.phtml +25 -0
  68. app/design/frontend/base/default/template/segment_analytics/subscribenewsletter.phtml +6 -0
  69. app/design/frontend/base/default/template/segment_analytics/viewedproduct.phtml +9 -0
  70. app/design/frontend/base/default/template/segment_analytics/viewedreviews.phtml +6 -0
  71. app/etc/.DS_Store +0 -0
  72. app/etc/modules/Segment_Analytics.xml +9 -0
  73. package.xml +2 -0
app/.DS_Store ADDED
Binary file
app/code/.DS_Store ADDED
Binary file
app/code/community/.DS_Store ADDED
Binary file
app/code/community/Segment/Analytics/Block/Json.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Block_Json extends Mage_Core_Block_Abstract
3
+ {
4
+ protected function _toHtml()
5
+ {
6
+ $var = $this->getVarName();
7
+ $json = $this->toJsonString();
8
+
9
+ if($this->getAsRawObject())
10
+ {
11
+ return $json;
12
+ }
13
+
14
+ return '<script type="text/javascript">' .
15
+ ' var ' . $var . " = " . $json . ";\n" .
16
+ '</script>';
17
+ }
18
+
19
+ public function toJsonString($data=false)
20
+ {
21
+ $data = $data ? $data : $this->getDataWithoutExtras();
22
+ $json = Mage::helper("core")->jsonEncode($data);
23
+ $json = preg_replace('%[\r\n]%','',$json);
24
+ return $json;
25
+ }
26
+
27
+ public function getDataWithoutExtras()
28
+ {
29
+ $data = $this->getData();
30
+ unset($data['type']);
31
+ unset($data['module_name']);
32
+ unset($data['var_name']);
33
+ unset($data['as_raw_object']);
34
+ return $data;
35
+ }
36
+ }
37
+
app/code/community/Segment/Analytics/Block/Template.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Block_Template extends Mage_Core_Block_Template
3
+ {
4
+ public function renderDataAsJsonVar($var_name)
5
+ {
6
+ return $this->getLayout()->createBlock('segment_analytics/json')
7
+ ->setData($this->getData())
8
+ ->setVarName($var_name)
9
+ ->toHtml();
10
+ }
11
+
12
+ public function renderDataAsJsonObject($key=false)
13
+ {
14
+ $data = $key ? $this->getData($key) : $this->getData();
15
+ return $this->getLayout()->createBlock('segment_analytics/json')
16
+ ->setData($data)
17
+ ->setAsRawObject(true)
18
+ ->toHtml();
19
+ }
20
+
21
+ public function getContextJson()
22
+ {
23
+ $renderer = $this->getLayout()->createBlock('segment_analytics/json')
24
+ ->setData(array(
25
+ 'library'=> array(
26
+ 'name'=>'analytics-magento',
27
+ 'version'=>(string) Mage::getConfig()->getNode()->modules->Segment_Analytics->version
28
+ )));
29
+ return $renderer->toJsonString();
30
+ }
31
+
32
+ /**
33
+ * Ensure safe JSON string, even for Magento systems still
34
+ * running on PHP 5.2
35
+ */
36
+ public function getPropertyAsJavascriptString($prop)
37
+ {
38
+ $data = (string) $this->getData($prop);
39
+ $data = json_encode($data);
40
+ $data = preg_replace('%[^ $:"\'a-z>0-9_-]%six','',$data);
41
+ return $data;
42
+ }
43
+ }
app/code/community/Segment/Analytics/Helper/Data.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ public function getWriteKey()
5
+ {
6
+ return Mage::getStoreConfig('segment_analytics/options/write_key');
7
+ }
8
+
9
+ public function isAdmin()
10
+ {
11
+ return Mage::app()->getStore()->isAdmin();
12
+ }
13
+
14
+ public function isEnabled()
15
+ {
16
+ return !$this->isAdmin() && $this->getWriteKey();
17
+ }
18
+
19
+ public function getCategoryNamesFromIds($ids)
20
+ {
21
+ $ids = is_array($ids) ? $ids : array($ids);
22
+ $categories = Mage::getModel('catalog/category')->getCollection()
23
+ ->addAttributeToSelect('name')
24
+ ->addFieldToFilter('entity_id', array('in'=>$ids));
25
+
26
+ $names = array();
27
+ foreach($categories as $category)
28
+ {
29
+ $names[] = $category->getName();
30
+ }
31
+ return $names;
32
+ }
33
+
34
+ /**
35
+ * Changes standard page titles per segment API. Hopefully
36
+ * this is kept to a minimum
37
+ * @todo refactor if this goes beyond page
38
+ */
39
+ public function getNormalizedPageTitle($title)
40
+ {
41
+ if(strpos($title, $this->__('Search results for')) !== false)
42
+ {
43
+ $title = 'Search Results';
44
+ }
45
+
46
+ return $title;
47
+ }
48
+
49
+ public function getNormalizedCustomerInformation($data)
50
+ {
51
+ $swap = array(
52
+ 'firstname'=>'first_name',
53
+ 'lastname'=>'last_name');
54
+
55
+ foreach($swap as $old=>$new)
56
+ {
57
+ if(!array_key_exists($old, $data))
58
+ {
59
+ continue;
60
+ }
61
+ $data[$new] = $data[$old];
62
+ unset($data[$old]);
63
+ }
64
+
65
+ return $this->_normalizeDatesToISO8601($data);
66
+ }
67
+
68
+ public function getNormalizedProductInformation($product)
69
+ {
70
+ //if passed id, load the product
71
+ if(!is_array($product))
72
+ {
73
+ $product = Mage::getModel('catalog/product_api')->info($product);
74
+ }
75
+
76
+ //calculate revenue, if present
77
+ $product['id'] = $product['product_id'];
78
+ if(array_key_exists('cost',$product))
79
+ {
80
+ $product['revenue'] = $product['price'] - $product['cost'];
81
+ }
82
+
83
+ //ensure category names/labels are sent along
84
+ $categories = Mage::getModel('catalog/category')->getCollection()
85
+ ->addAttributeToSelect('name')
86
+ ->addFieldToFilter('entity_id', array('in'=>$product['category_ids']));
87
+ foreach($categories as $category)
88
+ {
89
+ $product['categories'][] = $category->getName();
90
+ }
91
+
92
+ //cast numerics as floats per segment requirements
93
+ $as_float = array('price','weight');
94
+ foreach($as_float as $key)
95
+ {
96
+ if(!array_key_exists($key, $product)) { continue; }
97
+ $product[$key] = (float) $product[$key];
98
+ }
99
+
100
+ //segments wants "id" not product_id
101
+ if(array_key_exists('product_id', $product))
102
+ {
103
+ $product['id'] = $product['product_id'];
104
+ unset($product['product_id']);
105
+ }
106
+
107
+ $product = $this->getDataCastAsBooleans($product);
108
+ return $this->_normalizeDatesToISO8601($product);
109
+ }
110
+
111
+ /**
112
+ * Central place for casting of '1' and '0' as boolean
113
+ * where we know it needs to happen. Segment API requirement
114
+ */
115
+ public function getDataCastAsBooleans($data)
116
+ {
117
+ $keys_boolean = array('has_options','is_active','customer_is_guest','customer_note_notify',
118
+ 'email_sent','forced_shipment_with_invoice','paypal_ipn_customer_notified','is_virtual',
119
+ 'is_qty_decimal', 'no_discount','is_nominal');
120
+ foreach($keys_boolean as $key)
121
+ {
122
+ if(!array_key_exists($key, $data)) { continue; }
123
+ $data[$key] = (boolean) $data[$key];
124
+ }
125
+ return $this->_normalizeDatesToISO8601($data);
126
+ }
127
+
128
+ protected function _normalizeDatesToISO8601($data)
129
+ {
130
+ $date_fields = array('created_at', 'updated_at');
131
+ foreach($date_fields as $key)
132
+ {
133
+ if(!array_key_exists($key, $data))
134
+ {
135
+ continue;
136
+ }
137
+ $data[$key] = date(DATE_ISO8601,strToTime($data[$key]));
138
+ }
139
+ return $data;
140
+ }
141
+
142
+ public function normalizeReviewwData($data)
143
+ {
144
+ return $this->_normalizeDatesToISO8601($data);
145
+ }
146
+ }
app/code/community/Segment/Analytics/Model/Controller/Addedtowishlist.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Addedtowishlist extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $params = $block->getParams();
7
+ $info = Mage::getModel('catalog/product_api')
8
+ ->info($params['product_id']);
9
+
10
+ $info = Mage::helper('segment_analytics')
11
+ ->getNormalizedProductInformation($info);
12
+
13
+ $want = array('sku', 'price', 'name');
14
+ foreach($info as $key=>$value)
15
+ {
16
+ if(!in_array($key, $want)){continue;}
17
+ $params[$key] = $value;
18
+ }
19
+
20
+ $block->setParams($params);
21
+ return $block;
22
+ }
23
+ }
app/code/community/Segment/Analytics/Model/Controller/Addtocart.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Addtocart extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ return $block;
7
+ }
8
+ }
app/code/community/Segment/Analytics/Model/Controller/Alias.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Alias extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $customer = $this->_getCustomerSession();
7
+ if($customer->getCustomer()->getData('is_segment_aliased'))
8
+ {
9
+ return false;
10
+ }
11
+ $customer->getCustomer()->setData('is_segment_aliased','1')->save();
12
+ $block->setUserId($customer->getId());
13
+ return $block;
14
+ }
15
+
16
+
17
+ }
app/code/community/Segment/Analytics/Model/Controller/Amlistfav.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Amlistfav extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $info = Mage::getModel('catalog/product_api')->info($block->getProductId());
7
+ $info = Mage::helper('segment_analytics')
8
+ ->getNormalizedProductInformation($info);
9
+ $block->setParams($info);
10
+ return $block;
11
+ }
12
+ }
app/code/community/Segment/Analytics/Model/Controller/Base.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ abstract class Segment_Analytics_Model_Controller_Base
3
+ {
4
+ protected $_name;
5
+ protected $_data;
6
+ abstract public function getBlock($block);
7
+
8
+ public function dispatch()
9
+ {
10
+ $block = $this->_getDefaultBlock();
11
+ return $this->getBlock($block);
12
+ }
13
+
14
+ protected function _getDefaultBlock()
15
+ {
16
+ $key = Mage::helper('segment_analytics')->getWriteKey();
17
+ $block = $this->getLayout()->createBlock('segment_analytics/template')
18
+ ->setTemplate('segment_analytics/'.$this->getName().'.phtml')
19
+ ->setKey($key);
20
+ if(is_array($this->getData()))
21
+ {
22
+ $block->addData($this->getData());
23
+ }
24
+ return $block;
25
+ }
26
+
27
+ public function setData($value)
28
+ {
29
+ $this->_data = $value;
30
+ return $this;
31
+ }
32
+
33
+ public function getData()
34
+ {
35
+ return $this->_data;
36
+ }
37
+
38
+ public function setName($value)
39
+ {
40
+ $this->_name = $value;
41
+ return $this;
42
+ }
43
+
44
+ public function getName()
45
+ {
46
+ return $this->_name;
47
+ }
48
+
49
+ public function getLayout()
50
+ {
51
+ return Mage::getSingleton('core/layout');
52
+ }
53
+
54
+ public function getFullActionName($delimiter='_')
55
+ {
56
+ return $this->getRequest()->getRequestedRouteName().$delimiter.
57
+ $this->getRequest()->getRequestedControllerName().$delimiter.
58
+ $this->getRequest()->getRequestedActionName();
59
+ }
60
+
61
+ public function getRequest()
62
+ {
63
+ return Mage::app()->getRequest();
64
+ }
65
+
66
+
67
+ protected function _getCustomerSession()
68
+ {
69
+ return Mage::getSingleton('customer/session');
70
+ }
71
+
72
+ protected function _getCustomer()
73
+ {
74
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
75
+
76
+ //pull entire customer, including eav attributes not initially populated
77
+ $full_customer = Mage::getModel('customer/customer')->getCollection()
78
+ ->addAttributeToSelect('*')->addFieldToFilter('entity_id', $customer->getId())
79
+ ->getFirstItem();
80
+ return $full_customer;
81
+ }
82
+ }
app/code/community/Segment/Analytics/Model/Controller/Customerloggedin.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Customerloggedin extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $customer = $this->_getCustomer();
7
+ $block->setUserId($customer->getId());
8
+
9
+ $data = $block->getData();
10
+ $data = Mage::helper('segment_analytics')->getNormalizedCustomerInformation($data);
11
+ $block->setData($data);
12
+
13
+ return $block;
14
+ }
15
+ }
app/code/community/Segment/Analytics/Model/Controller/Customerloggedout.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Customerloggedout extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $customer = $block->getCustomer();
7
+ foreach(array('password_hash') as $key)
8
+ {
9
+ if(!array_key_exists($key, $customer)) { continue; }
10
+ unset($customer[$key]);
11
+ }
12
+ $customer = Mage::helper('segment_analytics')->getNormalizedCustomerInformation($customer);
13
+ $block->setUserId($customer['entity_id']);
14
+
15
+ return $block;
16
+ }
17
+ }
app/code/community/Segment/Analytics/Model/Controller/Customerregistered.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Customerregistered extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $data = $block->getData();
7
+ $data = Mage::helper('segment_analytics')->getNormalizedCustomerInformation($data);
8
+ $block->setData($data);
9
+ return $block;
10
+ }
11
+ }
app/code/community/Segment/Analytics/Model/Controller/Filteredproducts.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Filteredproducts extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ return $block;
7
+ }
8
+ }
app/code/community/Segment/Analytics/Model/Controller/Identity.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Identity extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $customer = $this->_getCustomer();
7
+
8
+ if(!$customer->getId())
9
+ {
10
+ return false;
11
+ }
12
+
13
+ $gender_label = $customer->getResource()
14
+ ->getAttribute('gender')
15
+ ->getSource()
16
+ ->getOptionText($customer->getData('gender'));
17
+
18
+ $block->setUserId($customer->getId())
19
+ ->addData($customer->getData())
20
+ ->setFullName($customer->getName())
21
+ ->setName($customer->getName())
22
+ ->setEmail($customer->getEmail())
23
+ ->setGroupId($customer->getGroupId())
24
+ ->setTaxClassId($customer->getTaxClassId())
25
+ ->setSharedStoreIds((array)$customer->getSharedStoreIds())
26
+ ->setSharedWebsiteIds((array)$customer->getSharedWebsiteIds())
27
+ ->setGender($gender_label)
28
+ ->setFirstName($customer->getFirstname())
29
+ ->setLastName($customer->getLastname())
30
+ ->setMiddleName($customer->getMiddlename())
31
+ ->setTotalOrders(
32
+ Mage::getSingleton('segment_analytics/query_totalpurchased')
33
+ ->fetchTotalOrders($customer->getId())
34
+ )
35
+ ->setTotalSpent(
36
+ Mage::getSingleton('segment_analytics/query_totalspent')
37
+ ->fetchTotalSpent($customer->getId())
38
+ )
39
+ ->unsetData('password_hash')
40
+ ->unsetData('firstname')
41
+ ->unsetData('lastname')
42
+ ->unsetData('middlename');
43
+
44
+ $data = $block->getData();
45
+ $data = Mage::helper('segment_analytics')->getNormalizedCustomerInformation($data);
46
+ $block->setData($data);
47
+ return $block;
48
+ }
49
+
50
+ }
app/code/community/Segment/Analytics/Model/Controller/Init.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Init extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ return $block;
7
+ }
8
+ }
app/code/community/Segment/Analytics/Model/Controller/Layerednavfilter.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Layerednavfilter extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $params = $block->getParams();
7
+
8
+ $params['category'] = Mage::helper('segment_analytics')
9
+ ->getCategoryNamesFromIds($params['request']['id']);
10
+ $block->setParams($params);
11
+
12
+ return $block;
13
+ }
14
+ }
app/code/community/Segment/Analytics/Model/Controller/Orderplaced.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Orderplaced extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $params = $block->getParams();
7
+
8
+ $info = Mage::getModel('sales/order_api')
9
+ ->info($params['increment_id']);
10
+
11
+ $params['total'] = (float) $info['grand_total'];
12
+ $params['status'] = $info['status'];
13
+ $params['shipping'] = (float) $info['shipping_amount'];
14
+ $params['tax'] = (float) $info['tax_amount'];
15
+ $params['products'] = array();
16
+ foreach($info['items'] as $item)
17
+ {
18
+ $tmp = array();
19
+ $tmp['sku'] = $item['sku'];
20
+ $tmp['name'] = $item['name'];;
21
+ $tmp['price'] = (float) $item['price'];
22
+ $tmp['quantity'] = (float) $item['qty_ordered'];
23
+ $tmp['product_id'] = (int) $item['product_id'];
24
+
25
+ //in case we ever add the boolean order items
26
+ $tmp = Mage::helper('segment_analytics')->getDataCastAsBooleans($item);
27
+ $params['products'][] = $tmp;
28
+ }
29
+
30
+ //too much information?
31
+ //$block->setParams($info);
32
+
33
+ //the serialized information
34
+ $block->setParams($params);
35
+
36
+ return $block;
37
+ }
38
+ }
app/code/community/Segment/Analytics/Model/Controller/Page.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Page extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $names = $this->_getCategoryNames();
7
+ $product = $this->_getCurrentProduct();
8
+ if($names)
9
+ {
10
+ $block->setCategoryNames($names)
11
+ ->setPageTitle('Category Listing')
12
+ ->setFullCategoryName(implode(' -> ',$names));
13
+ return $block;
14
+ }
15
+
16
+ if($product)
17
+ {
18
+ $block->setPageName('Product');
19
+ return $block;
20
+ }
21
+
22
+ $title = Mage::getSingleton('core/layout')->getBlock('head')->getTitle();
23
+ $title = Mage::helper('segment_analytics')->getNormalizedPageTitle($title);
24
+
25
+ $block->setPageName($title);
26
+
27
+ return $block;
28
+ }
29
+
30
+ protected function _getCurrentProduct()
31
+ {
32
+ return Mage::registry('product');
33
+ }
34
+
35
+ protected function _getCategoryPageHandles()
36
+ {
37
+ return array('catalog_category_view');
38
+ }
39
+
40
+ protected function _getCategoryNames()
41
+ {
42
+
43
+ if(!in_array($this->getFullActionName(), $this->_getCategoryPageHandles()))
44
+ {
45
+ return;
46
+ }
47
+
48
+ $current_category = Mage::registry('current_category');
49
+ $category = $current_category;
50
+ if(!$current_category)
51
+ {
52
+ return;
53
+ }
54
+ $ids = array($category->getId());
55
+ $categories = array($category);
56
+ while($parent_id = $category->getParentId())
57
+ {
58
+ $ids[] = $parent_id;
59
+ $category = Mage::getModel('catalog/category')->load($parent_id);
60
+ $categories[] = $category;
61
+ }
62
+ //pop off root
63
+ array_pop($categories);
64
+ $names = array();
65
+ foreach($categories as $category)
66
+ {
67
+ $names[] = $category->getName();
68
+ }
69
+ $names = array_reverse($names);
70
+ return $names;
71
+ }
72
+
73
+ }
app/code/community/Segment/Analytics/Model/Controller/Removefromcart.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Removefromcart extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ return $block;
7
+ }
8
+ }
app/code/community/Segment/Analytics/Model/Controller/Reviewedproduct.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Reviewedproduct extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $review = $block->getReview();
7
+ unset($review['customer_id']);
8
+ unset($review['form_key']);
9
+ $review = Mage::helper('segment_analytics')->normalizeReviewwData($review);
10
+ $block->setReview($review);
11
+ return $block;
12
+ }
13
+ }
app/code/community/Segment/Analytics/Model/Controller/Searchedproducts.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Searchedproducts extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ return $block;
7
+ }
8
+ }
app/code/community/Segment/Analytics/Model/Controller/Subscribenewsletter.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Subscribenewsletter extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ return $block;
7
+ }
8
+ }
app/code/community/Segment/Analytics/Model/Controller/Viewedproduct.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Viewedproduct extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $params = $block->getParams();
7
+ // $product = Mage::getModel('catalog/product_api')->info($params['id']);
8
+
9
+ $product = Mage::helper('segment_analytics')
10
+ ->getNormalizedProductInformation($params['id']);
11
+
12
+ $block->setParams($product);
13
+ return $block;
14
+ }
15
+ }
app/code/community/Segment/Analytics/Model/Controller/Viewedreviews.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Controller_Viewedreviews extends Segment_Analytics_Model_Controller_Base
3
+ {
4
+ public function getBlock($block)
5
+ {
6
+ $params = $block->getParams();
7
+
8
+ $info = Mage::getModel('catalog/product_api')
9
+ ->info($params['id']);
10
+
11
+ $info = Mage::helper('segment_analytics')
12
+ ->getNormalizedProductInformation($info);
13
+
14
+ $want = array('sku', 'price', 'name');
15
+ foreach($info as $key=>$value)
16
+ {
17
+ if(!in_array($key, $want)){continue;}
18
+ $params[$key] = $value;
19
+ }
20
+
21
+ $block->setParams($params);
22
+ return $block;
23
+ }
24
+ }
app/code/community/Segment/Analytics/Model/Front/Controller.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Front Controller for segment actions. Simple
4
+ * static class to avoid extra Magento perf. overhead
5
+ */
6
+ class Segment_Analytics_Model_Front_Controller
7
+ {
8
+ static protected $_instance;
9
+ protected $_actions=array();
10
+ protected $_actionsData=array();
11
+
12
+ static public function getInstance()
13
+ {
14
+ if(!self::$_instance)
15
+ {
16
+ self::$_instance = new Segment_Analytics_Model_Front_Controller;
17
+ }
18
+ return self::$_instance;
19
+ }
20
+
21
+ public function addDeferredAction($action, $action_data=array())
22
+ {
23
+ Mage::Log("Adding Deferred Action $action");
24
+
25
+ $o_action = new stdClass;
26
+ $o_action->action = $action;
27
+ $o_action->data = $action_data;
28
+
29
+ $session = $this->_getSession();
30
+ $deferred = $session->getDeferredActions();
31
+ $deferred = $deferred ? $deferred : array();
32
+ $deferred[] = $o_action;
33
+ $session->setDeferredActions($deferred);
34
+
35
+ return $this;
36
+ }
37
+
38
+ public function clearDeferredActions()
39
+ {
40
+ Mage::getSingleton('segment_analytics/session')
41
+ ->setDeferredActions(array())
42
+ ->setDeferredActionsData(array());
43
+ Mage::Log("Cleared Deferred Action");
44
+ return $this;
45
+ }
46
+
47
+ public function getDeferredActions()
48
+ {
49
+ $actions = Mage::getSingleton('segment_analytics/session')
50
+ ->getDeferredActions();
51
+ $actions = $actions ? $actions : array();
52
+ return $actions;
53
+ }
54
+
55
+ protected function _getSession()
56
+ {
57
+ return Mage::getSingleton('segment_analytics/session');
58
+ }
59
+
60
+ public function addAction($action,$data=array())
61
+ {
62
+ $this->_actions[] = $action;
63
+ $this->_actionsData[$action] = $data;
64
+ return $this;
65
+ }
66
+
67
+ public function getBlocks()
68
+ {
69
+ $blocks[] = array();
70
+ foreach($this->_actions as $action)
71
+ {
72
+ $class = 'Segment_Analytics_Model_Controller_' . ucwords($action);
73
+ $controller = new $class;
74
+ $controller->setName($action)
75
+ ->setData($this->_actionsData[$action]);
76
+ $blocks[$action][] = $controller->dispatch();
77
+ }
78
+
79
+ foreach($this->getDeferredActions() as $action)
80
+ {
81
+ $class = 'Segment_Analytics_Model_Controller_' . ucwords($action->action);
82
+ $controller = new $class;
83
+ $controller->setName($action->action)
84
+ ->setData($action->data);
85
+ $blocks[$action->action][] = $controller->dispatch();
86
+ }
87
+
88
+ //reorder based on sort priority, filter out !blocks
89
+ $blocks_ordered = array();
90
+ $sort_order = $this->getSortOrder();
91
+ $orders = array_keys($sort_order);
92
+ sort($orders);
93
+ foreach($orders as $order)
94
+ {
95
+ $action = $sort_order[$order];
96
+ if(!array_key_exists($action, $blocks)) { continue; }
97
+ $blocks_ordered[$action] = $blocks[$action];
98
+ unset($blocks[$action]);
99
+ }
100
+
101
+ //now any blocks not included in the sort order
102
+ foreach($blocks as $block)
103
+ {
104
+ $blocks_ordered[] = $block;
105
+ }
106
+ $this->clearDeferredActions();
107
+
108
+ //flatten array
109
+ $final = array();
110
+ foreach($blocks_ordered as $array)
111
+ {
112
+ foreach($array as $block)
113
+ {
114
+ $final[] = $block;
115
+ }
116
+
117
+ }
118
+ return $final;
119
+ }
120
+
121
+ protected function getSortOrder()
122
+ {
123
+ return array(
124
+ 10=>'init',
125
+ 30=>'alias',
126
+ 20=>'page',
127
+ 40=>'identity',
128
+ );
129
+ }
130
+ }
app/code/community/Segment/Analytics/Model/Observer.php ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Observer
3
+ {
4
+ const CONTAINER_BLOCKNAME = 'segment_analytics_before_body_end';
5
+
6
+ public function addContainerBlock($observer)
7
+ {
8
+ #Mage::Log($_SERVER['SCRIPT_URI']);
9
+ #Mage::Log("Start addContainerBlocks");
10
+ $layout = Mage::getSingleton('core/layout');
11
+ if(!$layout)
12
+ {
13
+ Mage::Log("No Layout Object in " . __METHOD__);
14
+ return;
15
+ }
16
+
17
+ $before_body_end = $layout->getBlock('before_body_end');
18
+ if(!$before_body_end)
19
+ {
20
+ Mage::Log("No before body end in " . __METHOD__);
21
+ return;
22
+ }
23
+
24
+ if(!Mage::helper('segment_analytics')->isEnabled())
25
+ {
26
+ return;
27
+ }
28
+
29
+ $container = $layout->createBlock('core/text_list', self::CONTAINER_BLOCKNAME);
30
+ $before_body_end->append($container);
31
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
32
+ $blocks = $front->getBlocks();
33
+ // var_dump($blocks);
34
+ foreach($blocks as $block)
35
+ {
36
+ if(!$block) { continue; }
37
+ $items = $block = is_array($block) ? $block : array($block);
38
+
39
+ foreach($items as $block)
40
+ {
41
+ $container->append($block);
42
+ }
43
+ }
44
+ Mage::Log("Finished addContainerBlocks");
45
+ }
46
+
47
+ /**
48
+ * Adds the "always" items
49
+ */
50
+ public function addFrotnendScripts($observer)
51
+ {
52
+ $layout = $observer->getLayout();
53
+ if(!$layout)
54
+ {
55
+ return;
56
+ }
57
+ if(!Mage::helper('segment_analytics')->isEnabled())
58
+ {
59
+ return;
60
+ }
61
+
62
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
63
+ $front->addAction('init');
64
+ $front->addAction('page');
65
+ }
66
+
67
+ public function loggedIn($observer)
68
+ {
69
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
70
+ $front->addDeferredAction('alias');
71
+ $front->addDeferredAction('identity');
72
+ $front->addDeferredAction('customerloggedin');
73
+ }
74
+
75
+ public function loggedOut($observer)
76
+ {
77
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
78
+ $front->addDeferredAction('customerloggedout', array(
79
+ 'customer'=>$this->_getCustomerData()
80
+ ));
81
+ }
82
+
83
+ public function addToCart($observer)
84
+ {
85
+ $product = $observer->getProduct();
86
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
87
+ $front->addDeferredAction('addtocart',
88
+ array('sku'=>$product->getSku())
89
+ );
90
+ }
91
+
92
+ public function removeFromCart($observer)
93
+ {
94
+ $product = $observer->getQuoteItem()->getProduct();
95
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
96
+ $front->addDeferredAction('removefromcart',
97
+ array('sku'=>$product->getSku())
98
+ );
99
+ }
100
+
101
+ public function customerRegistered($observer)
102
+ {
103
+ $customer = $observer->getCustomer();
104
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
105
+ $front->addDeferredAction('customerregistered',
106
+ array('customer_id'=>$customer->getEntityId())
107
+ );
108
+ }
109
+
110
+ public function loadedSearch($observer)
111
+ {
112
+ $o = $observer->getDataObject();
113
+ if(!$o){return;}
114
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
115
+ $front->addDeferredAction('searchedproducts',
116
+ array('query'=>$o->getQueryText())
117
+ );
118
+ }
119
+
120
+ public function categoryViewForFiltering($observer)
121
+ {
122
+ $action = $observer->getAction();
123
+ if(!$action){ return; }
124
+
125
+ $request = $action->getRequest();
126
+ if(!$request) { return; }
127
+
128
+ $params = $request->getParams();
129
+
130
+ //use presense of "dir" to flag for filtering.
131
+ //no need for an action handle check
132
+ if(!array_key_exists('dir', $params))
133
+ {
134
+ return;
135
+ }
136
+
137
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
138
+ $front->addDeferredAction('filteredproducts',
139
+ array('params'=>$params)
140
+ );
141
+
142
+ }
143
+
144
+ public function productView($observer)
145
+ {
146
+ $action = $observer->getAction();
147
+ if(!$action){ return; }
148
+
149
+ $request = $action->getRequest();
150
+ if(!$request) { return; }
151
+
152
+ $params = $request->getParams();
153
+
154
+ if (!in_array($action->getFullActionName(), array('catalog_product_view')))
155
+ {
156
+ return;
157
+ }
158
+
159
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
160
+ $front->addDeferredAction('viewedproduct',
161
+ array('params'=>$params)
162
+ );
163
+ }
164
+
165
+ public function favSaved($observer)
166
+ {
167
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
168
+ $item = $observer->getData('data_object');
169
+
170
+ if($item->getResourceName() == 'amlist/item')
171
+ {
172
+ $front->addDeferredAction('amlistfav',
173
+ array('product_id'=>$item->getData('product_id'))
174
+ );
175
+ }
176
+ }
177
+
178
+ public function reviewView($observer)
179
+ {
180
+ $action = $observer->getAction();
181
+ if(!$action){ return; }
182
+
183
+ $request = $action->getRequest();
184
+ if(!$request) { return; }
185
+
186
+ $params = $request->getParams();
187
+
188
+ if (!in_array($action->getFullActionName(), array('review_product_list')))
189
+ {
190
+ return;
191
+ }
192
+
193
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
194
+ $front->addDeferredAction('viewedreviews',
195
+ array('params'=>$params)
196
+ );
197
+
198
+ }
199
+
200
+ public function newsletterSubscriber($observer)
201
+ {
202
+ $subscriber = $observer->getDataObject();
203
+ if(!$subscriber->getSubscriberStatus())
204
+ {
205
+ return;
206
+ }
207
+
208
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
209
+ $front->addDeferredAction('subscribenewsletter',
210
+ array('subscriber'=>$subscriber->getData())
211
+ );
212
+ }
213
+
214
+ public function wishlistAddProduct($observer)
215
+ {
216
+ $product = $observer->getProduct();
217
+ $wishlist = $observer->getWishlist();
218
+
219
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
220
+ $front->addDeferredAction('addedtowishlist',
221
+ array('params'=>array('product_id'=>$product->getId()))
222
+ );
223
+
224
+ }
225
+
226
+ public function viewedImageFrontendTrack($observer)
227
+ {
228
+ if(!Mage::helper('segment_analytics')->isEnabled())
229
+ {
230
+ return;
231
+ }
232
+
233
+ $action = $observer->getAction();
234
+ if(!$action){ return; }
235
+
236
+ $layout = Mage::getSingleton('core/layout');
237
+
238
+ $content = $layout->getBlock('content');
239
+ if(!$content) { return; }
240
+
241
+ $content->append(
242
+ $layout->createBlock('segment_analytics/template')
243
+ ->setTemplate('segment_analytics/image-frontend.phtml')
244
+ );
245
+ }
246
+
247
+ public function orderPlaced($observer)
248
+ {
249
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
250
+ $front->addDeferredAction('orderplaced',
251
+ array('params'=>array(
252
+ 'order_id'=>$observer->getOrder()->getId(),
253
+ 'increment_id'=>$observer->getOrder()->getIncrementId(),
254
+ ))
255
+ );
256
+ }
257
+
258
+ public function logBlockHtml($observer)
259
+ {
260
+ if($observer->getBlock()->getNameInLayout() != self::CONTAINER_BLOCKNAME)
261
+ {
262
+ return;
263
+ }
264
+
265
+ Mage::Log($observer->getTransport()->getHtml(), Zend_Log::INFO, 'segment.log');
266
+ }
267
+
268
+ public function addClickedShareJavascript($observer)
269
+ {
270
+ $action = $observer->getAction();
271
+ if(!$action){ return; }
272
+
273
+ if($action->getFullActionName() != 'catalog_product_view')
274
+ {
275
+ return;
276
+ }
277
+
278
+ $layout = Mage::getSingleton('core/layout');
279
+
280
+ $content = $layout->getBlock('content');
281
+ if(!$content)
282
+ {
283
+ return;
284
+ }
285
+
286
+ $block = $layout->createBlock('segment_analytics/template')
287
+ ->setTemplate('segment_analytics/share-frontend.phtml');
288
+
289
+ $content->append($block);
290
+ }
291
+
292
+ public function addClickedReviewTabJavascript($observer)
293
+ {
294
+ $action = $observer->getAction();
295
+ if(!$action){ return; }
296
+
297
+ if($action->getFullActionName() != 'catalog_product_view')
298
+ {
299
+ return;
300
+ }
301
+
302
+ $layout = Mage::getSingleton('core/layout');
303
+
304
+ $content = $layout->getBlock('content');
305
+ if(!$content)
306
+ {
307
+ return;
308
+ }
309
+ $block = $layout->createBlock('segment_analytics/template')
310
+ ->setTemplate('segment_analytics/review-frontend.phtml');
311
+
312
+ $content->append($block);
313
+ }
314
+
315
+ protected function _getCustomer()
316
+ {
317
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
318
+
319
+ //pull entire customer, including eav attributes not initially populated
320
+ $full_customer = Mage::getModel('customer/customer')->getCollection()
321
+ ->addAttributeToSelect('*')->addFieldToFilter('entity_id', $customer->getId())
322
+ ->getFirstItem();
323
+
324
+ return $full_customer;
325
+ }
326
+
327
+ protected function _getCustomerData()
328
+ {
329
+ $customer = $this->_getCustomer();
330
+ if($customer)
331
+ {
332
+ $customer = Mage::helper('segment_analytics')->getNormalizedCustomerInformation($customer->getData());
333
+ return $customer;
334
+ }
335
+ return array();
336
+ }
337
+ }
app/code/community/Segment/Analytics/Model/Observer/Admin.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Observer_Admin
3
+ {
4
+ public function addExplainationTextToConfigScreen($observer)
5
+ {
6
+ $action = $observer->getAction();
7
+ if(!$action)
8
+ {
9
+ return;
10
+ }
11
+
12
+ if($action->getRequest()->getParam('section') !== 'segment_analytics')
13
+ {
14
+ return;
15
+ }
16
+
17
+ $layout = Mage::getSingleton('core/layout');
18
+ $content = $layout->getBlock('content');
19
+
20
+ if(!$content)
21
+ {
22
+ return;
23
+ }
24
+
25
+ $json = new stdClass;
26
+ $json->content = $layout->createBlock('adminhtml/template')
27
+ ->setTemplate('segment_analytics/welcome.phtml')
28
+ ->toHtml();
29
+
30
+ $json = Mage::helper('core')->jsonEncode($json);
31
+ $block = $layout->createBlock('adminhtml/template')
32
+ ->setTemplate('segment_analytics/welcome-container.phtml')
33
+ ->setContentJson($json);
34
+
35
+ $content->append($block);
36
+
37
+ // var_dump($content);
38
+ // exit;
39
+ }
40
+ }
app/code/community/Segment/Analytics/Model/Observer/Customer.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Observer_Customer
3
+ {
4
+ const PARAM_CUSTOMER_ID = 'segment_customer_id';
5
+ static protected $_customer;
6
+ public function grabCustomerId($observer)
7
+ {
8
+ self::$_customer = $this->_getCustomer();
9
+ }
10
+
11
+ public function addCustomerIdParamater($observer)
12
+ {
13
+ $action = $observer->getControllerAction();
14
+ $customer = self::$_customer;
15
+ $action->setRedirectWithCookieCheck(
16
+ '*/*/logoutSuccess', array(self::PARAM_CUSTOMER_ID=>$customer->getId())
17
+ );
18
+ }
19
+
20
+ public function addCustomerTrackingIfIdPresent($observer)
21
+ {
22
+ $customer_id = Mage::app()->getRequest()->getParam(self::PARAM_CUSTOMER_ID);
23
+ if(!$customer_id) { return; }
24
+
25
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
26
+ $front->addDeferredAction('customerloggedout', array(
27
+ 'customer'=>$this->_getCustomerData($customer_id)
28
+ ));
29
+ }
30
+
31
+ protected function _getCustomerData($id)
32
+ {
33
+ $full_customer = Mage::getModel('customer/customer')->getCollection()
34
+ ->addAttributeToSelect('*')->addFieldToFilter('entity_id', $id)
35
+ ->getFirstItem();
36
+ if($full_customer)
37
+ {
38
+ return $full_customer->getData();
39
+ }
40
+ return array();
41
+ }
42
+
43
+ protected function _getCustomer()
44
+ {
45
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
46
+
47
+ //pull entire customer, including eav attributes not initially populated
48
+ $full_customer = Mage::getModel('customer/customer')->getCollection()
49
+ ->addAttributeToSelect('*')->addFieldToFilter('entity_id', $customer->getId())
50
+ ->getFirstItem();
51
+ return $full_customer;
52
+ }
53
+ }
app/code/community/Segment/Analytics/Model/Observer/Layered.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Observer_Layered
3
+ {
4
+ static $_isFiltered;
5
+ public function flagIsFiltered($observer)
6
+ {
7
+ self::$_isFiltered = true;
8
+ }
9
+
10
+ public function addLayeredLimitation($observer)
11
+ {
12
+ if(!self::$_isFiltered) { return; }
13
+
14
+ $action = $observer->getAction();
15
+ if(!$action){ return; }
16
+
17
+ if (!in_array($action->getFullActionName(), array('catalog_category_view')))
18
+ {
19
+ return;
20
+ }
21
+
22
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
23
+ $front->addDeferredAction('layerednavfilter',
24
+ array('params'=>array('request'=>Mage::app()->getRequest()->getParams()))
25
+ );
26
+ }
27
+
28
+ }
app/code/community/Segment/Analytics/Model/Observer/Review.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Observer_Review
3
+ {
4
+ static protected $_review;
5
+ public function markReviewSaved($observer)
6
+ {
7
+ self::$_review = $observer->getObject();
8
+ }
9
+
10
+ public function reviewedProduct($observer)
11
+ {
12
+ $review = self::$_review;
13
+ if(!$review->getId())
14
+ {
15
+ return;
16
+ }
17
+
18
+ $front = Segment_Analytics_Model_Front_Controller::getInstance();
19
+ $front->addDeferredAction('reviewedproduct',
20
+ array('review'=>$review->getData())
21
+ );
22
+ }
23
+
24
+
25
+ }
app/code/community/Segment/Analytics/Model/Query/.DS_Store ADDED
Binary file
app/code/community/Segment/Analytics/Model/Query/Totalpurchased.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Query_Totalpurchased
3
+ {
4
+ public function fetchTotalOrders($customer_id)
5
+ {
6
+ $core_resource = Mage::getModel('core/resource');
7
+ $read = $core_resource->getConnection('core_read');
8
+ $sql = 'SELECT count(customer_id) as total FROM ' . $core_resource->getTableName('sales/order') . ' ' .
9
+ 'WHERE customer_id = ?';
10
+ $query = $read->query($sql,$customer_id);
11
+
12
+ $result = $query->execute();
13
+ $row = $query->fetch();
14
+
15
+ return array_key_exists('total', $row) ? $row['total'] : 0;
16
+ }
17
+ }
app/code/community/Segment/Analytics/Model/Query/Totalspent.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Query_Totalspent
3
+ {
4
+ public function fetchTotalSpent($customer_id)
5
+ {
6
+ $core_resource = Mage::getModel('core/resource');
7
+ $read = $core_resource->getConnection('core_read');
8
+ $sql = 'SELECT sum(grand_total) as total FROM ' . $core_resource->getTableName('sales/order') . ' ' .
9
+ 'WHERE customer_id = ?';
10
+ $query = $read->query($sql,$customer_id);
11
+ $result = $query->execute();
12
+ $row = $query->fetch();
13
+
14
+ return array_key_exists('total', $row) ? $row['total'] : 0;
15
+
16
+ }
17
+ }
app/code/community/Segment/Analytics/Model/Resource/Setup.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup
3
+ {
4
+
5
+ }
app/code/community/Segment/Analytics/Model/Session.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_Model_Session extends Mage_Core_Model_Session_Abstract
3
+ {
4
+ public function __construct()
5
+ {
6
+ if(!session_id())
7
+ {
8
+ Mage::throwException("No session id. Blocking rather than instantiate object early.");
9
+ }
10
+ $this->init('segment_analytics');
11
+ }
12
+ }
app/code/community/Segment/Analytics/controllers/IndexController.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Segment_Analytics_IndexController extends Mage_Core_Controller_Front_Action {
3
+ public function indexAction()
4
+ {
5
+ $this->loadLayout();
6
+ $this->renderLayout();
7
+ }
8
+ }
app/code/community/Segment/Analytics/etc/adminhtml.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <acl>
3
+ <resources>
4
+ <admin>
5
+ <children>
6
+ <system>
7
+ <children>
8
+ <config>
9
+ <children>
10
+ <segment_analytics>
11
+ <title>Segment Options</title>
12
+ </segment_analytics>
13
+ </children>
14
+ </config>
15
+ </children>
16
+ </system>
17
+ </children>
18
+ </admin>
19
+ </resources>
20
+ </acl>
21
+ </config>
app/code/community/Segment/Analytics/etc/config.xml ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Segment_Analytics>
5
+ <version>1.0.0</version>
6
+ </Segment_Analytics>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <segment_analytics>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Segment_Analytics</module>
14
+ <frontName>segment_analytics</frontName>
15
+ </args>
16
+ </segment_analytics>
17
+ </routers>
18
+ </frontend>
19
+ <global>
20
+ <resources>
21
+ <segment_analytics_setup>
22
+ <setup>
23
+ <module>Segment_Analytics</module>
24
+ <class>Segment_Analytics_Model_Resource_Setup</class>
25
+ </setup>
26
+ </segment_analytics_setup>
27
+ </resources>
28
+ <events>
29
+
30
+ <controller_action_layout_generate_blocks_after>
31
+ <observers>
32
+ <segment_analyticsmore_scripts_addfrontend>
33
+ <type>singleton</type>
34
+ <class>segment_analytics/observer</class>
35
+ <method>addFrotnendScripts</method>
36
+ </segment_analyticsmore_scripts_addfrontend>
37
+ </observers>
38
+ </controller_action_layout_generate_blocks_after>
39
+
40
+ <customer_login>
41
+ <observers>
42
+ <segment_analyticsmore_scripts>
43
+ <type>singleton</type>
44
+ <class>segment_analytics/observer</class>
45
+ <method>loggedIn</method>
46
+ </segment_analyticsmore_scripts>
47
+ </observers>
48
+ </customer_login>
49
+
50
+ <customer_logout>
51
+ <observers>
52
+ <segment_analyticsmore_scripts>
53
+ <type>singleton</type>
54
+ <class>segment_analytics/observer</class>
55
+ <method>loggedOut</method>
56
+ </segment_analyticsmore_scripts>
57
+ </observers>
58
+ </customer_logout>
59
+
60
+ <checkout_cart_add_product_complete>
61
+ <observers>
62
+ <segment_analyticsmore_scripts>
63
+ <type>singleton</type>
64
+ <class>segment_analytics/observer</class>
65
+ <method>addToCart</method>
66
+ </segment_analyticsmore_scripts>
67
+ </observers>
68
+ </checkout_cart_add_product_complete>
69
+
70
+ <sales_quote_remove_item>
71
+ <observers>
72
+ <segment_analyticsmore_scripts_remove_item>
73
+ <type>singleton</type>
74
+ <class>segment_analytics/observer</class>
75
+ <method>removeFromCart</method>
76
+ </segment_analyticsmore_scripts_remove_item>
77
+ </observers>
78
+ </sales_quote_remove_item>
79
+
80
+ <controller_action_layout_render_before>
81
+ <observers>
82
+ <segment_analyticsmore_blocks>
83
+ <type>singleton</type>
84
+ <class>segment_analytics/observer</class>
85
+ <method>addContainerBlock</method>
86
+ </segment_analyticsmore_blocks>
87
+ </observers>
88
+ </controller_action_layout_render_before>
89
+
90
+ <catalogsearch_query_load_after>
91
+ <observers>
92
+ <segment_analyticsmore_search>
93
+ <type>singleton</type>
94
+ <class>segment_analytics/observer</class>
95
+ <method>loadedSearch</method>
96
+ </segment_analyticsmore_search>
97
+ </observers>
98
+ </catalogsearch_query_load_after>
99
+
100
+ <customer_register_success>
101
+ <observers>
102
+ <segment_analyticsmore_customer_register_success>
103
+ <type>singleton</type>
104
+ <class>segment_analytics/observer</class>
105
+ <method>customerRegistered</method>
106
+ </segment_analyticsmore_customer_register_success>
107
+ </observers>
108
+ </customer_register_success>
109
+
110
+ <controller_action_layout_generate_blocks_after>
111
+ <observers>
112
+ <segment_analyticsmore_category_view_for_share_tab>
113
+ <type>singleton</type>
114
+ <class>segment_analytics/observer</class>
115
+ <method>addClickedShareJavascript</method>
116
+ </segment_analyticsmore_category_view_for_share_tab>
117
+ </observers>
118
+ </controller_action_layout_generate_blocks_after>
119
+
120
+ <controller_action_layout_generate_blocks_after>
121
+ <observers>
122
+ <segment_analyticsmore_category_view_for_review_tab>
123
+ <type>singleton</type>
124
+ <class>segment_analytics/observer</class>
125
+ <method>addClickedReviewTabJavascript</method>
126
+ </segment_analyticsmore_category_view_for_review_tab>
127
+ </observers>
128
+ </controller_action_layout_generate_blocks_after>
129
+
130
+ <controller_action_layout_generate_blocks_after>
131
+ <observers>
132
+ <segment_analyticsmore_category_view_for_image_thumbs>
133
+ <type>singleton</type>
134
+ <class>segment_analytics/observer</class>
135
+ <method>viewedImageFrontendTrack</method>
136
+ </segment_analyticsmore_category_view_for_image_thumbs>
137
+ </observers>
138
+ </controller_action_layout_generate_blocks_after>
139
+
140
+ <controller_action_layout_generate_blocks_after>
141
+ <observers>
142
+ <segment_analyticsmore_category_view_for_filtering>
143
+ <type>singleton</type>
144
+ <class>segment_analytics/observer</class>
145
+ <method>categoryViewForFiltering</method>
146
+ </segment_analyticsmore_category_view_for_filtering>
147
+ </observers>
148
+ </controller_action_layout_generate_blocks_after>
149
+
150
+ <controller_action_layout_generate_blocks_after>
151
+ <observers>
152
+ <segment_analyticsmore_category_view_for_welcome>
153
+ <type>singleton</type>
154
+ <class>segment_analytics/observer_admin</class>
155
+ <method>addExplainationTextToConfigScreen</method>
156
+ </segment_analyticsmore_category_view_for_welcome>
157
+ </observers>
158
+ </controller_action_layout_generate_blocks_after>
159
+
160
+ <catalog_product_collection_apply_limitations_after>
161
+ <observers>
162
+ <segment_analyticsmore_catalog_product_collection_apply_limitations_after>
163
+ <type>singleton</type>
164
+ <class>segment_analytics/observer_layered</class>
165
+ <method>flagIsFiltered</method>
166
+ </segment_analyticsmore_catalog_product_collection_apply_limitations_after>
167
+ </observers>
168
+ </catalog_product_collection_apply_limitations_after>
169
+
170
+ <controller_action_predispatch_catalog_product_gallery>
171
+ <observers>
172
+ <segment_analyticsmore_catalog_product_collection_apply_limitations_after>
173
+ <type>singleton</type>
174
+ <class>segment_analytics/observer</class>
175
+ <method>productGalleryViewed</method>
176
+ </segment_analyticsmore_catalog_product_collection_apply_limitations_after>
177
+ </observers>
178
+ </controller_action_predispatch_catalog_product_gallery>
179
+
180
+
181
+ <controller_action_layout_generate_blocks_after>
182
+ <observers>
183
+ <segment_analyticsmore_category_view>
184
+ <type>singleton</type>
185
+ <class>segment_analytics/observer_layered</class>
186
+ <method>addLayeredLimitation</method>
187
+ </segment_analyticsmore_category_view>
188
+ </observers>
189
+ </controller_action_layout_generate_blocks_after>
190
+
191
+ <controller_action_layout_generate_blocks_after>
192
+ <observers>
193
+ <segment_analyticsmore_review_view>
194
+ <type>singleton</type>
195
+ <class>segment_analytics/observer</class>
196
+ <method>reviewView</method>
197
+ </segment_analyticsmore_review_view>
198
+ </observers>
199
+ </controller_action_layout_generate_blocks_after>
200
+
201
+ <controller_action_layout_generate_blocks_after>
202
+ <observers>
203
+ <segment_analyticsmore_product_view>
204
+ <type>singleton</type>
205
+ <class>segment_analytics/observer</class>
206
+ <method>productView</method>
207
+ </segment_analyticsmore_product_view>
208
+ </observers>
209
+ </controller_action_layout_generate_blocks_after>
210
+
211
+ <core_abstract_save_after>
212
+ <observers>
213
+ <segment_analyticsmore_amasty_fav_save_after>
214
+ <type>singleton</type>
215
+ <class>segment_analytics/observer</class>
216
+ <method>favSaved</method>
217
+ </segment_analyticsmore_amasty_fav_save_after>
218
+ </observers>
219
+ </core_abstract_save_after>
220
+
221
+ <review_save_after>
222
+ <observers>
223
+ <segment_analyticsmore_review_save_after>
224
+ <type>singleton</type>
225
+ <class>segment_analytics/observer_review</class>
226
+ <method>markReviewSaved</method>
227
+ </segment_analyticsmore_review_save_after>
228
+ </observers>
229
+ </review_save_after>
230
+
231
+ <controller_action_postdispatch_review_product_post>
232
+ <observers>
233
+ <segment_analyticsmore_review_product_post>
234
+ <type>singleton</type>
235
+ <class>segment_analytics/observer_review</class>
236
+ <method>reviewedProduct</method>
237
+ </segment_analyticsmore_review_product_post>
238
+ </observers>
239
+ </controller_action_postdispatch_review_product_post>
240
+
241
+ <newsletter_subscriber_save_after>
242
+ <observers>
243
+ <segment_analyticsmore_newsletter_save_after>
244
+ <type>singleton</type>
245
+ <class>segment_analytics/observer</class>
246
+ <method>newsletterSubscriber</method>
247
+ </segment_analyticsmore_newsletter_save_after>
248
+ </observers>
249
+ </newsletter_subscriber_save_after>
250
+
251
+ <wishlist_add_product>
252
+ <observers>
253
+ <segment_analyticsmore_wishlist_add>
254
+ <type>singleton</type>
255
+ <class>segment_analytics/observer</class>
256
+ <method>wishlistAddProduct</method>
257
+ </segment_analyticsmore_wishlist_add>
258
+ </observers>
259
+ </wishlist_add_product>
260
+
261
+ <sales_order_place_after>
262
+ <observers>
263
+ <segment_analyticsmore_sales_order_place_after>
264
+ <type>singleton</type>
265
+ <class>segment_analytics/observer</class>
266
+ <method>orderPlaced</method>
267
+ </segment_analyticsmore_sales_order_place_after>
268
+ </observers>
269
+ </sales_order_place_after>
270
+
271
+ <core_block_abstract_to_html_after>
272
+ <observers>
273
+ <segment_analyticsmore_sales_logger>
274
+ <type>singleton</type>
275
+ <class>segment_analytics/observer</class>
276
+ <method>logBlockHtml</method>
277
+ </segment_analyticsmore_sales_logger>
278
+ </observers>
279
+ </core_block_abstract_to_html_after>
280
+
281
+ <controller_action_predispatch_customer_account_logout>
282
+ <observers>
283
+ <segment_analyticsmore_sales_logger>
284
+ <type>singleton</type>
285
+ <class>segment_analytics/observer_customer</class>
286
+ <method>grabCustomerId</method>
287
+ </segment_analyticsmore_sales_logger>
288
+ </observers>
289
+ </controller_action_predispatch_customer_account_logout>
290
+
291
+ <controller_action_postdispatch_customer_account_logout>
292
+ <observers>
293
+ <segment_analyticsmore_sales_logger>
294
+ <type>singleton</type>
295
+ <class>segment_analytics/observer_customer</class>
296
+ <method>addCustomerIdParamater</method>
297
+ </segment_analyticsmore_sales_logger>
298
+ </observers>
299
+ </controller_action_postdispatch_customer_account_logout>
300
+
301
+ <controller_action_layout_generate_blocks_after>
302
+ <observers>
303
+ <segment_analyticsmore_sales_logger>
304
+ <type>singleton</type>
305
+ <class>segment_analytics/observer_customer</class>
306
+ <method>addCustomerTrackingIfIdPresent</method>
307
+ </segment_analyticsmore_sales_logger>
308
+ </observers>
309
+ </controller_action_layout_generate_blocks_after>
310
+
311
+
312
+ </events>
313
+
314
+ <blocks>
315
+ <segment_analytics>
316
+ <class>Segment_Analytics_Block</class>
317
+ </segment_analytics>
318
+ </blocks>
319
+ <models>
320
+ <segment_analytics>
321
+ <class>Segment_Analytics_Model</class>
322
+ </segment_analytics>
323
+ </models>
324
+ <helpers>
325
+ <segment_analytics>
326
+ <class>Segment_Analytics_Helper</class>
327
+ </segment_analytics>
328
+ </helpers>
329
+ </global>
330
+ </config>
app/code/community/Segment/Analytics/etc/system.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <sections>
3
+ <segment_analytics translate="label" module="segment_analytics">
4
+ <label>Analytics</label>
5
+ <tab>general</tab>
6
+ <frontend_type>text</frontend_type>
7
+ <sort_order>101</sort_order>
8
+ <show_in_default>1</show_in_default>
9
+ <show_in_website>1</show_in_website>
10
+ <show_in_store>1</show_in_store>
11
+ <groups>
12
+ <options>
13
+ <label>Segment</label>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>9999</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <fields>
20
+ <write_key>
21
+ <!-- http://alanstorm.com/magento_system_configuration_in_depth_tutorial -->
22
+ <label>Write Key</label>
23
+ <comment>Your Unique Segment Write Key</comment>
24
+ <frontend_type>text</frontend_type>
25
+ <!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
26
+ <!-- <backend_model>core/config_data</backend_model> -->
27
+ <sort_order>10</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ </write_key>
32
+ </fields>
33
+ </options>
34
+ </groups>
35
+ </segment_analytics>
36
+ </sections>
37
+ </config>
app/code/community/Segment/Analytics/sql/segment_analytics_setup/install-0.0.2.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $this->startSetup();
3
+ $entity = $this->getEntityTypeId('customer');
4
+
5
+ /* create the new attribute */
6
+ $this->addAttribute($entity, 'is_segment_aliased', array(
7
+ 'type' => 'text', /* input type */
8
+ 'label' => 'Segment Aliased', /* Label for the user to read */
9
+ 'input' => 'text', /* input type */
10
+ 'visible' => FALSE, /* users can see it */
11
+ 'required' => FALSE, /* is it required, self-explanatory */
12
+ 'default_value' => 'default', /* default value */
13
+ 'adminhtml_only' => '1' /* use in admin html only */
14
+ ));
15
+
16
+ /* save the setup */
17
+ $this->endSetup();
app/code/community/Segment/Analytics/sql/segment_analytics_setup/upgrade-0.0.2-0.0.3.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $path_local = Mage::getBaseDir() . '/errors/local.xml';
3
+ $extra = '';
4
+ if(file_exists($path_local))
5
+ {
6
+ //local.xml already exists, create file as segment.xml with info
7
+ $path_local = Mage::getBaseDir() . '/errors/segment_analytics_local.xml';
8
+ $extra = 'Replace your current errors/local.xml with this file to enable Segment Tracking';
9
+ }
10
+
11
+ $xml = '<?xml version="1.0"?>
12
+ <config>
13
+ <!-- ' . $extra . '-->
14
+ <skin>segment_analytics</skin>
15
+ </config>
16
+ ';
17
+
18
+ if(is_writable(dirname($path_local)))
19
+ {
20
+ file_put_contents($path_local, $xml);
21
+ }
app/design/.DS_Store ADDED
Binary file
app/design/adminhtml/default/default/template/segment_analytics/welcome-container.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ var segment_analytics_intro = <?php echo $this->getContentJson();?>;
3
+ document.observe('dom:loaded', function(){
4
+ $('config_edit_form').innerHTML = segment_analytics_intro.content + $('config_edit_form').innerHTML;
5
+ });
6
+ </script>
app/design/adminhtml/default/default/template/segment_analytics/welcome.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <h3>Welcome</h3>
2
+ <p>
3
+ Intro text/html goes here.
4
+ </p>
app/design/frontend/.DS_Store ADDED
Binary file
app/design/frontend/base/.DS_Store ADDED
Binary file
app/design/frontend/base/default/template/segment_analytics/addedtowishlist.phtml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar("segment_analytics_addedtowishlist");?>
2
+ <script type="text/javascript">
3
+ analytics.track("Wishlisted Product",
4
+ <?php echo $this->renderDataAsJsonObject('params'); ?>,
5
+ <?php echo $this->getContextJson(); ?>
6
+ );
7
+ </script>
app/design/frontend/base/default/template/segment_analytics/addtocart.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar('segment_analytics_addtocart'); ?>
2
+ <script type="text/javascript">
3
+ analytics.track('Added Product',{'sku':<?php echo $this->getPropertyAsJavascriptString('sku');?>},
4
+ <?php echo $this->getContextJson(); ?>);
5
+ </script>
app/design/frontend/base/default/template/segment_analytics/alias.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar('segment_analytics_alias'); ?>
2
+ <script type="text/javascript">
3
+ analytics.alias(<?php echo $this->getPropertyAsJavascriptString('user_id');?>, <?php echo $this->getContextJson(); ?>);
4
+ </script>
app/design/frontend/base/default/template/segment_analytics/amlistfav.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar("segment_analytics_amlistfav");?>
2
+ <script type="text/javascript">
3
+ analytics.track("Favorited Product",
4
+ <?php echo $this->renderDataAsJsonObject('params'); ?>,
5
+ <?php echo $this->getContextJson(); ?>);
6
+ </script>
app/design/frontend/base/default/template/segment_analytics/customerloggedin.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar('segment_analytics_customerloggedin'); ?>
2
+ <script type="text/javascript">
3
+ analytics.track('Logged In',{},
4
+ <?php echo $this->getContextJson(); ?>);
5
+ </script>
app/design/frontend/base/default/template/segment_analytics/customerloggedout.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar('segment_analytics_customerloggedout'); ?>
2
+ <script type="text/javascript">
3
+ analytics.track('Logged Out',{},
4
+ <?php echo $this->getContextJson(); ?>);
5
+ </script>
app/design/frontend/base/default/template/segment_analytics/customerregistered.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar('segment_analytics_customerregistered'); ?>
2
+ <script type="text/javascript">
3
+ analytics.track('Registered',{},<?php echo $this->getContextJson(); ?>);
4
+ </script>
app/design/frontend/base/default/template/segment_analytics/filteredproducts.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar('segment_analytics_filtered'); ?>
2
+ <script type="text/javascript">
3
+ analytics.track('Filtered Products',
4
+ <?php echo $this->renderDataAsJsonObject('params'); ?>,
5
+ <?php echo $this->getContextJson(); ?>);
6
+ </script>
app/design/frontend/base/default/template/segment_analytics/identity.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //echo $this->renderDataAsJsonVar('segment_analytics_identity');
3
+ $json_to_send = Mage::helper('core')->jsonDecode($this->renderDataAsJsonObject());
4
+ unset($json_to_send['key']);
5
+ unset($json_to_send['user_id']);
6
+ if(array_key_exists('gender', $json_to_send) && $json_to_send['gender'] === false)
7
+ {
8
+ unset($json_to_send['gender']);
9
+ }
10
+ $json_to_send = Mage::helper('core')->jsonEncode($json_to_send);
11
+ ?>
12
+ <script type="text/javascript">
13
+ analytics.identify(<?php echo $this->getPropertyAsJavascriptString('user_id');?>,
14
+ <?php echo $json_to_send; ?>,
15
+ <?php echo $this->getContextJson(); ?>);
16
+
17
+ </script>
app/design/frontend/base/default/template/segment_analytics/image-frontend.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ document.observe("dom:loaded", function() {
3
+ $$('.more-views img, .product-image-thumbs img').each(function(node){
4
+ node.observe('click',function(event){
5
+ var target = event.target ? event.target : event.srcElement;
6
+ if(!window.analytics)
7
+ {
8
+ return;
9
+ }
10
+ if(!segment_analytics_viewedproduct || !segment_analytics_viewedproduct.params)
11
+ {
12
+ return;
13
+ }
14
+
15
+ window.analytics.track('Viewed Product Image',
16
+ {'src': target.src,
17
+ 'product': segment_analytics_viewedproduct.params},
18
+ <?php echo $this->getContextJson(); ?>
19
+ );
20
+ });
21
+ });
22
+ });
23
+ </script>
app/design/frontend/base/default/template/segment_analytics/init.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar('segment_analytics_init'); ?>
2
+
3
+ <script type="text/javascript">
4
+ window.analytics=window.analytics||[],window.analytics.methods=["identify","group","track","page","pageview","alias","ready","on","once","off","trackLink","trackForm","trackClick","trackSubmit"],window.analytics.factory=function(t){return function(){var a=Array.prototype.slice.call(arguments);return a.unshift(t),window.analytics.push(a),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var key=window.analytics.methods[i];window.analytics[key]=window.analytics.factory(key)}window.analytics.load=function(t){if(!document.getElementById("analytics-js")){var a=document.createElement("script");a.type="text/javascript",a.id="analytics-js",a.async=!0,a.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.io/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n)}},window.analytics.SNIPPET_VERSION="2.0.9",
5
+ window.analytics.load(<?php echo $this->getPropertyAsJavascriptString('key');?>);
6
+ </script>
app/design/frontend/base/default/template/segment_analytics/layerednavfilter.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar("segment_analytics_layerednavfilter");?>
2
+ <script type="text/javascript">
3
+ analytics.track("Filtered Products",
4
+ <?php echo $this->renderDataAsJsonObject('params'); ?>,
5
+ <?php echo $this->getContextJson(); ?>);
6
+ </script>
app/design/frontend/base/default/template/segment_analytics/orderplaced.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar("segment_analytics_orderplaced");?>
2
+ <script type="text/javascript">
3
+ analytics.track("Completed Order",
4
+ <?php echo $this->renderDataAsJsonObject('params'); ?>,
5
+ <?php echo $this->getContextJson(); ?>);
6
+ </script>
app/design/frontend/base/default/template/segment_analytics/page.phtml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->renderDataAsJsonVar('segment_analytics_page');?>
2
+ <script type="text/javascript">
3
+ if(segment_analytics_page.category_names)
4
+ {
5
+ window.analytics.page(<?php echo $this->getPropertyAsJavascriptString('full_category_name');?>, <?php echo $this->getPropertyAsJavascriptString('full_category_name');?>,{},<?php echo $this->getContextJson(); ?>);
6
+ }
7
+ else
8
+ {
9
+ window.analytics.page(<?php echo $this->getPropertyAsJavascriptString('page_name');?>,{},<?php echo $this->getContextJson(); ?>);
10
+ }
11
+ </script>
app/design/frontend/base/default/template/segment_analytics/removefromcart.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar('segment_analytics_removefromcart'); ?>
2
+ <script type="text/javascript">
3
+ analytics.track('Removed Product',{'sku':<?php echo $this->getPropertyAsJavascriptString('sku');?>},
4
+ <?php echo $this->getContextJson(); ?> );
5
+ </script>
app/design/frontend/base/default/template/segment_analytics/review-frontend.phtml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //new RWD gives us no IDs to hook into
3
+ $data = array();
4
+ echo $this->setReviewLabel(Mage::helper('core')->__('Reviews'))
5
+ ->renderDataAsJsonVar('segment_analytics_frontend_review');
6
+ ?>
7
+ <script type="text/javascript">
8
+ if(window['$j'])
9
+ {
10
+ //rwd — jquery block prototype observe
11
+ var selector = '#collateral-tabs';
12
+ $j(selector).parent().click(function(e){
13
+ if( $j(e.target).html().indexOf(segment_analytics_frontend_review.review_label) === -1 )
14
+ {
15
+ return;
16
+ }
17
+ segment_analytics_trackreview();
18
+ });
19
+
20
+ }
21
+
22
+ var segment_analytics_trackreview = function()
23
+ {
24
+ analytics.track("Viewed Product Reviews",
25
+ {'product': <?php echo $this->renderDataAsJsonObject('params'); ?>},
26
+ <?php echo $this->getContextJson(); ?>);
27
+
28
+ }
29
+ </script>
app/design/frontend/base/default/template/segment_analytics/reviewedproduct.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar("segment_analytics_reviewedproduct");?>
2
+ <script type="text/javascript">
3
+ analytics.track("Reviewed Product",
4
+ <?php echo $this->renderDataAsJsonObject('review'); ?>,
5
+ <?php echo $this->getContextJson(); ?>);
6
+ </script>
app/design/frontend/base/default/template/segment_analytics/searchedproducts.phtml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar('segment_analytics_searched'); ?>
2
+ <script type="text/javascript">
3
+ analytics.track('Searched Products',{
4
+ 'query':<?php echo $this->getPropertyAsJavascriptString('query');?>
5
+ },
6
+ <?php echo $this->getContextJson(); ?> );
7
+ </script>
app/design/frontend/base/default/template/segment_analytics/share-frontend.phtml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ document.observe('dom:loaded',function(){
3
+ var shared_product = function(network)
4
+ {
5
+ analytics.track("Shared Product",
6
+ {'product': segment_analytics_viewedproduct.params,
7
+ 'network':network},
8
+ <?php echo $this->getContextJson(); ?>);
9
+ }
10
+
11
+ var shared_product_facebook = function()
12
+ {
13
+ shared_product('Facebook');
14
+ }
15
+
16
+ var shared_product_twitter = function()
17
+ {
18
+ shared_product('Twitter');
19
+ }
20
+
21
+ $($$('a.link-facebook')[0]).observe('click', shared_product_facebook);
22
+ $($$('a.link-twitter')[0]).observe('click', shared_product_twitter);
23
+ })
24
+
25
+ </script>
app/design/frontend/base/default/template/segment_analytics/subscribenewsletter.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar("segment_analytics_subscribenewsletter");?>
2
+ <script type="text/javascript">
3
+ analytics.track("Subscribed to Newsletter",
4
+ <?php echo $this->renderDataAsJsonObject('subscriber'); ?>,
5
+ <?php echo $this->getContextJson(); ?> );
6
+ </script>
app/design/frontend/base/default/template/segment_analytics/viewedproduct.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //segment_analytics_viewedproduct also used by various *-frontend phtml templates
3
+ echo $this->renderDataAsJsonVar("segment_analytics_viewedproduct");
4
+ ?>
5
+ <script type="text/javascript">
6
+ analytics.track("Viewed Product",
7
+ <?php echo $this->renderDataAsJsonObject('params'); ?>,
8
+ <?php echo $this->getContextJson(); ?>);
9
+ </script>
app/design/frontend/base/default/template/segment_analytics/viewedreviews.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php //echo $this->renderDataAsJsonVar("segment_analytics_viewedreviews");?>
2
+ <script type="text/javascript">
3
+ analytics.track("Viewed Product Reviews",
4
+ <?php echo $this->renderDataAsJsonObject('params'); ?>,
5
+ <?php echo $this->getContextJson(); ?>);
6
+ </script>
app/etc/.DS_Store ADDED
Binary file
app/etc/modules/Segment_Analytics.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Segment_Analytics>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Segment_Analytics>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0"?>
2
+ <package><name>analytics</name><version>1.0.0</version><stability>stable</stability><license>MIT</license><channel>community</channel><extends></extends><summary>Segment lets you integrate 100+ analytics and marketing tools without writing any code yourself!</summary><description>Analytics for Magento is a Magento extension by Segment that lets you integrate any analytics or marketing tool you want with the flick of a switch! No code required. When you turn on the plugin, Segment automatically starts tracking important actions, like when users view items, add products to carts, and complete orders. To send this data along to your preferred tools, just go to the Segment control panel and toggle them on. This will save you months of time installing analytics.</description><notes></notes><authors><author><name>Segment</name><user>segmentio</user><email>friends@segment.io</email></author></authors><date>2014-08-27</date><time>14:16:20</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Segment"><dir name="Analytics"><dir name="Block"><file name="Json.php" hash="77a1bf5dc11b0379bac45ffe92503920"/><file name="Template.php" hash="ad6f341d5288024dadcfa052b94f1cc5"/></dir><dir name="controllers"><file name="IndexController.php" hash="f25a06d702a86f32d0e3667b7a52e51c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a4f61645101a34f67e08215a2a8c2bb1"/><file name="config.xml" hash="5b7a9e4d71e63f13b72eea5a8c584aca"/><file name="system.xml" hash="2409544d3ed47080d92e0f1fa6462844"/></dir><dir name="Helper"><file name="Data.php" hash="1f9dbac5666d28ae93dc4a78ec491eec"/></dir><dir name="Model"><file name="Observer.php" hash="5d7dec868e794dfbbfc18373adaa19bd"/><file name="Session.php" hash="b704f5a8e83a1e88710cce75c14ca8b2"/><dir name="Controller"><file name="Addedtowishlist.php" hash="d7554a3dfeba4389403da77cd8b9b577"/><file name="Addtocart.php" hash="0ed8cda5125f80e3adb88092ba98c010"/><file name="Alias.php" hash="01957c9ecb7bd18ebbf6b683aa1e26d8"/><file name="Amlistfav.php" hash="77c241aeb10e847809c261fb987ea231"/><file name="Base.php" hash="dbd5d3c31ca986fab5874ba436d92a0a"/><file name="Customerloggedin.php" hash="b90cac939fb3c2cf26bbd7ebc21b0d15"/><file name="Customerloggedout.php" hash="b17fa8edb2705a7a95f1e6d1211d2fb6"/><file name="Customerregistered.php" hash="bab7b09c54e80aea887b762730bace85"/><file name="Filteredproducts.php" hash="d9f5aa27812bcb2707765c8295daa33d"/><file name="Identity.php" hash="36f14a9431cabac05bbf6d3303b9b298"/><file name="Init.php" hash="880bd8d529a07f6a04616e2c98664fe8"/><file name="Layerednavfilter.php" hash="e687405d3e661929fd8ddaf07d1a4e34"/><file name="Orderplaced.php" hash="9484057c4f72c550d8cc9a4ea9d8ca5d"/><file name="Page.php" hash="1877a140c41d0fffa30f691fe19ca807"/><file name="Removefromcart.php" hash="73728c33dfa7e422ce052f260dc075d1"/><file name="Reviewedproduct.php" hash="7e5b66d243c7ac56f9e2e1cfc1a4778a"/><file name="Searchedproducts.php" hash="b7cbb325af5125831577be64c38d38b7"/><file name="Subscribenewsletter.php" hash="53bfffba6959a93f815aae40c90a12a5"/><file name="Viewedproduct.php" hash="eb7c8ad13434f25ce1b5b51583308e4a"/><file name="Viewedreviews.php" hash="154c63d724e842afdf8aa018bd551146"/></dir><dir name="Front"><file name="Controller.php" hash="15ad3f72050f44af9bf1eef6311221a4"/></dir><dir name="Observer"><file name="Admin.php" hash="0f5c6957505dc3135ff23a2b4bb005ff"/><file name="Customer.php" hash="1268ea7f63cae14b688d28889f83d1d4"/><file name="Layered.php" hash="df5693db18782d72e12c8712f20b1031"/><file name="Review.php" hash="8ae59c8446076c1e8876fff3e0a15edf"/></dir><dir name="Query"><file name="Totalpurchased.php" hash="ffb2adc54cfb045d2206a5637cb1c980"/><file name="Totalspent.php" hash="38981ad7ad5aa871d158a1f57062a123"/></dir><dir name="Resource"><file name="Setup.php" hash="05b44bd356c73b475c570b4f39858847"/></dir></dir><dir name="sql"><dir name="segment_analytics_setup"><file name="install-0.0.2.php" hash="6ed374aa1a926ea2da213b7b48688b81"/><file name="upgrade-0.0.2-0.0.3.php" hash="4f5832020a9db0fee5311ed0bfe06df9"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="segment_analytics"><file name="welcome-container.phtml" hash="675be69e78118174cc1913bdee1f5eb0"/><file name="welcome.phtml" hash="8a04ca3a7ae4e1c652d64a3486e52704"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="segment_analytics"><file name="addedtowishlist.phtml" hash="510ea8734d75965f337fb7196ea86591"/><file name="addtocart.phtml" hash="fb095200ccc633a634acee8e034915e8"/><file name="alias.phtml" hash="3e2f76491ca3870b7145d95613489515"/><file name="amlistfav.phtml" hash="8950bdf6d8bf6a758c3a27261dbcfeea"/><file name="customerloggedin.phtml" hash="b6459b72a3af74500c3e0fd600b9b66d"/><file name="customerloggedout.phtml" hash="7b45941a2b39f3a3bb66180b511f073e"/><file name="customerregistered.phtml" hash="2ae49ebdc261a2ac12666e3f8c88007b"/><file name="filteredproducts.phtml" hash="7bfea3e857aa5cf94d80ac560569215c"/><file name="identity.phtml" hash="9fba8707a755dad51fb4bb2ff66dce15"/><file name="image-frontend.phtml" hash="a82ed48dfcfef10b4e78a03872bda182"/><file name="init.phtml" hash="50ba787142268624339c493b36f057f0"/><file name="layerednavfilter.phtml" hash="c3f57076a76864e8d7c1f939de687b00"/><file name="orderplaced.phtml" hash="1cbe1c7731bb30848bf0cf1204c6e895"/><file name="page.phtml" hash="f4d6d0b78e49e673627bb3477f9fa32a"/><file name="removefromcart.phtml" hash="302e80b60e4fdb78468696fbb728d4e5"/><file name="review-frontend.phtml" hash="de336d1ad12ffe5cf041c041590c01a1"/><file name="reviewedproduct.phtml" hash="322faa7da6e7b93e236ebff643dd45c3"/><file name="searchedproducts.phtml" hash="bbe966c2b2069ab4cacc204435686c6f"/><file name="share-frontend.phtml" hash="d8a2f53dfb00c271ea653861df7caacc"/><file name="subscribenewsletter.phtml" hash="796e37fa23ec051fd8ff62e80ddb8301"/><file name="viewedproduct.phtml" hash="63948db8120cffa034f291fb295bb1ad"/><file name="viewedreviews.phtml" hash="2e433131130d2f7580f25e3b3d3b03c7"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Segment_Analytics.xml" hash="b594b15ca2fb8187ab8fb49673c91e03"/></dir></dir></dir></target></contents></package>