Version Notes
Download this release
Release Info
Developer | Segment |
Extension | analytics |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 2.0.0
- app/code/community/Segment/Analytics/Helper/Data.php +17 -0
- app/code/community/Segment/Analytics/Model/Controller/Addtocart.php +7 -0
- app/code/community/Segment/Analytics/Model/Controller/Customerloggedout.php +2 -3
- app/code/community/Segment/Analytics/Model/Controller/Identity.php +7 -7
- app/code/community/Segment/Analytics/Model/Controller/Removefromcart.php +8 -1
- app/code/community/Segment/Analytics/Model/Observer.php +3 -2
- app/code/community/Segment/Analytics/Model/Observer/Customer.php +0 -53
- app/code/community/Segment/Analytics/etc/config.xml +71 -85
- app/code/community/Segment/Analytics/etc/system.xml +25 -6
- app/design/frontend/base/default/template/segment_analytics/addtocart.phtml +2 -1
- app/design/frontend/base/default/template/segment_analytics/customerloggedout.phtml +6 -2
- app/design/frontend/base/default/template/segment_analytics/identity.phtml +5 -3
- app/design/frontend/base/default/template/segment_analytics/removefromcart.phtml +3 -2
- package.xml +1 -1
app/code/community/Segment/Analytics/Helper/Data.php
CHANGED
@@ -6,6 +6,11 @@ class Segment_Analytics_Helper_Data extends Mage_Core_Helper_Abstract
|
|
6 |
return Mage::getStoreConfig('segment_analytics/options/write_key');
|
7 |
}
|
8 |
|
|
|
|
|
|
|
|
|
|
|
9 |
public function isAdmin()
|
10 |
{
|
11 |
return Mage::app()->getStore()->isAdmin();
|
@@ -121,7 +126,19 @@ class Segment_Analytics_Helper_Data extends Mage_Core_Helper_Abstract
|
|
121 |
unset($product['product_id']);
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
$product = $this->getDataCastAsBooleans($product);
|
|
|
|
|
|
|
125 |
return $this->_normalizeDatesToISO8601($product);
|
126 |
}
|
127 |
|
6 |
return Mage::getStoreConfig('segment_analytics/options/write_key');
|
7 |
}
|
8 |
|
9 |
+
public function flushAfterLogout()
|
10 |
+
{
|
11 |
+
return Mage::getStoreConfig('segment_analytics/options/logout_flush');
|
12 |
+
}
|
13 |
+
|
14 |
public function isAdmin()
|
15 |
{
|
16 |
return Mage::app()->getStore()->isAdmin();
|
126 |
unset($product['product_id']);
|
127 |
}
|
128 |
|
129 |
+
$blacklist = trim(Mage::getStoreConfig('segment_analytics/options/product_properties'));
|
130 |
+
$blacklistedFields = preg_split('%[\n\r]%', $blacklist, -1, PREG_SPLIT_NO_EMPTY);
|
131 |
+
|
132 |
+
foreach($blacklistedFields as $key)
|
133 |
+
{
|
134 |
+
if(!array_key_exists($key, $product)) { continue; }
|
135 |
+
unset($product[$key]);
|
136 |
+
}
|
137 |
+
|
138 |
$product = $this->getDataCastAsBooleans($product);
|
139 |
+
$product = array_filter($product, function($v, $k) {
|
140 |
+
return !is_null($v);
|
141 |
+
});
|
142 |
return $this->_normalizeDatesToISO8601($product);
|
143 |
}
|
144 |
|
app/code/community/Segment/Analytics/Model/Controller/Addtocart.php
CHANGED
@@ -3,6 +3,13 @@ class Segment_Analytics_Model_Controller_Addtocart extends Segment_Analytics_Mod
|
|
3 |
{
|
4 |
public function getBlock($block)
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
return $block;
|
7 |
}
|
8 |
}
|
3 |
{
|
4 |
public function getBlock($block)
|
5 |
{
|
6 |
+
$product = $block->getProduct();
|
7 |
+
|
8 |
+
$product = Mage::helper('segment_analytics')
|
9 |
+
->getNormalizedProductInformation($product);
|
10 |
+
|
11 |
+
$block->setProduct($product);
|
12 |
+
|
13 |
return $block;
|
14 |
}
|
15 |
}
|
app/code/community/Segment/Analytics/Model/Controller/Customerloggedout.php
CHANGED
@@ -3,15 +3,14 @@ class Segment_Analytics_Model_Controller_Customerloggedout extends Segment_Analy
|
|
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 |
}
|
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 |
return $block;
|
15 |
}
|
16 |
}
|
app/code/community/Segment/Analytics/Model/Controller/Identity.php
CHANGED
@@ -2,7 +2,7 @@
|
|
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())
|
@@ -14,7 +14,7 @@ class Segment_Analytics_Model_Controller_Identity extends Segment_Analytics_Mode
|
|
14 |
->getAttribute('gender')
|
15 |
->getSource()
|
16 |
->getOptionText($customer->getData('gender'));
|
17 |
-
|
18 |
$address = Mage::getModel('customer/address')->load(
|
19 |
$customer->getDefaultBilling()
|
20 |
);
|
@@ -23,7 +23,7 @@ class Segment_Analytics_Model_Controller_Identity extends Segment_Analytics_Mode
|
|
23 |
->addData($customer->getData())
|
24 |
->setFullName($customer->getName())
|
25 |
->setName($customer->getName())
|
26 |
-
->setEmail($customer->getEmail())
|
27 |
->setGroupId($customer->getGroupId())
|
28 |
->setTaxClassId($customer->getTaxClassId())
|
29 |
->setSharedStoreIds((array)$customer->getSharedStoreIds())
|
@@ -31,7 +31,7 @@ class Segment_Analytics_Model_Controller_Identity extends Segment_Analytics_Mode
|
|
31 |
->setGender($gender_label)
|
32 |
->setFirstName($customer->getFirstname())
|
33 |
->setLastName($customer->getLastname())
|
34 |
-
->setMiddleName($customer->getMiddlename())
|
35 |
->setTotalOrders(
|
36 |
Mage::getSingleton('segment_analytics/query_totalpurchased')
|
37 |
->fetchTotalOrders($customer->getId())
|
@@ -44,7 +44,7 @@ class Segment_Analytics_Model_Controller_Identity extends Segment_Analytics_Mode
|
|
44 |
->unsetData('firstname')
|
45 |
->unsetData('lastname')
|
46 |
->unsetData('middlename');
|
47 |
-
|
48 |
if($address)
|
49 |
{
|
50 |
$region = Mage::getModel('directory/region')->load($address->getRegionId());
|
@@ -57,10 +57,10 @@ class Segment_Analytics_Model_Controller_Identity extends Segment_Analytics_Mode
|
|
57 |
->setData('state', $region->getCode())
|
58 |
->setData('street', $street);
|
59 |
}
|
60 |
-
$data = $block->getData();
|
61 |
$data = Mage::helper('segment_analytics')->getNormalizedCustomerInformation($data);
|
62 |
$block->setData($data);
|
63 |
return $block;
|
64 |
}
|
65 |
-
|
66 |
}
|
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())
|
14 |
->getAttribute('gender')
|
15 |
->getSource()
|
16 |
->getOptionText($customer->getData('gender'));
|
17 |
+
|
18 |
$address = Mage::getModel('customer/address')->load(
|
19 |
$customer->getDefaultBilling()
|
20 |
);
|
23 |
->addData($customer->getData())
|
24 |
->setFullName($customer->getName())
|
25 |
->setName($customer->getName())
|
26 |
+
->setEmail($customer->getEmail())
|
27 |
->setGroupId($customer->getGroupId())
|
28 |
->setTaxClassId($customer->getTaxClassId())
|
29 |
->setSharedStoreIds((array)$customer->getSharedStoreIds())
|
31 |
->setGender($gender_label)
|
32 |
->setFirstName($customer->getFirstname())
|
33 |
->setLastName($customer->getLastname())
|
34 |
+
->setMiddleName($customer->getMiddlename())
|
35 |
->setTotalOrders(
|
36 |
Mage::getSingleton('segment_analytics/query_totalpurchased')
|
37 |
->fetchTotalOrders($customer->getId())
|
44 |
->unsetData('firstname')
|
45 |
->unsetData('lastname')
|
46 |
->unsetData('middlename');
|
47 |
+
|
48 |
if($address)
|
49 |
{
|
50 |
$region = Mage::getModel('directory/region')->load($address->getRegionId());
|
57 |
->setData('state', $region->getCode())
|
58 |
->setData('street', $street);
|
59 |
}
|
60 |
+
$data = $block->getData();
|
61 |
$data = Mage::helper('segment_analytics')->getNormalizedCustomerInformation($data);
|
62 |
$block->setData($data);
|
63 |
return $block;
|
64 |
}
|
65 |
+
|
66 |
}
|
app/code/community/Segment/Analytics/Model/Controller/Removefromcart.php
CHANGED
@@ -3,6 +3,13 @@ class Segment_Analytics_Model_Controller_Removefromcart extends Segment_Analytic
|
|
3 |
{
|
4 |
public function getBlock($block)
|
5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
return $block;
|
7 |
}
|
8 |
-
}
|
3 |
{
|
4 |
public function getBlock($block)
|
5 |
{
|
6 |
+
$product = $block->getProduct();
|
7 |
+
|
8 |
+
$product = Mage::helper('segment_analytics')
|
9 |
+
->getNormalizedProductInformation($product);
|
10 |
+
|
11 |
+
$block->setProduct($product);
|
12 |
+
|
13 |
return $block;
|
14 |
}
|
15 |
+
}
|
app/code/community/Segment/Analytics/Model/Observer.php
CHANGED
@@ -61,6 +61,7 @@ class Segment_Analytics_Model_Observer
|
|
61 |
|
62 |
$front = Segment_Analytics_Model_Front_Controller::getInstance();
|
63 |
$front->addAction('init');
|
|
|
64 |
$front->addAction('page');
|
65 |
}
|
66 |
|
@@ -85,7 +86,7 @@ class Segment_Analytics_Model_Observer
|
|
85 |
$product = $observer->getProduct();
|
86 |
$front = Segment_Analytics_Model_Front_Controller::getInstance();
|
87 |
$front->addDeferredAction('addtocart',
|
88 |
-
array('
|
89 |
);
|
90 |
}
|
91 |
|
@@ -94,7 +95,7 @@ class Segment_Analytics_Model_Observer
|
|
94 |
$product = $observer->getQuoteItem()->getProduct();
|
95 |
$front = Segment_Analytics_Model_Front_Controller::getInstance();
|
96 |
$front->addDeferredAction('removefromcart',
|
97 |
-
array('
|
98 |
);
|
99 |
}
|
100 |
|
61 |
|
62 |
$front = Segment_Analytics_Model_Front_Controller::getInstance();
|
63 |
$front->addAction('init');
|
64 |
+
$front->addDeferredAction('identity');
|
65 |
$front->addAction('page');
|
66 |
}
|
67 |
|
86 |
$product = $observer->getProduct();
|
87 |
$front = Segment_Analytics_Model_Front_Controller::getInstance();
|
88 |
$front->addDeferredAction('addtocart',
|
89 |
+
array('product'=>$product)
|
90 |
);
|
91 |
}
|
92 |
|
95 |
$product = $observer->getQuoteItem()->getProduct();
|
96 |
$front = Segment_Analytics_Model_Front_Controller::getInstance();
|
97 |
$front->addDeferredAction('removefromcart',
|
98 |
+
array('product'=>$product)
|
99 |
);
|
100 |
}
|
101 |
|
app/code/community/Segment/Analytics/Model/Observer/Customer.php
DELETED
@@ -1,53 +0,0 @@
|
|
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/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Segment_Analytics>
|
5 |
-
<version>
|
6 |
</Segment_Analytics>
|
7 |
</modules>
|
8 |
<frontend>
|
@@ -17,13 +17,13 @@
|
|
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 |
|
@@ -35,7 +35,7 @@
|
|
35 |
<method>addFrotnendScripts</method>
|
36 |
</segment_analyticsmore_scripts_addfrontend>
|
37 |
</observers>
|
38 |
-
</controller_action_layout_generate_blocks_after>
|
39 |
|
40 |
<customer_login>
|
41 |
<observers>
|
@@ -43,7 +43,7 @@
|
|
43 |
<type>singleton</type>
|
44 |
<class>segment_analytics/observer</class>
|
45 |
<method>loggedIn</method>
|
46 |
-
</segment_analyticsmore_scripts>
|
47 |
</observers>
|
48 |
</customer_login>
|
49 |
|
@@ -53,30 +53,30 @@
|
|
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>
|
@@ -86,7 +86,7 @@
|
|
86 |
</segment_analyticsmore_blocks>
|
87 |
</observers>
|
88 |
</controller_action_layout_render_before>
|
89 |
-
|
90 |
<catalogsearch_query_load_after>
|
91 |
<observers>
|
92 |
<segment_analyticsmore_search>
|
@@ -94,7 +94,7 @@
|
|
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>
|
@@ -104,7 +104,7 @@
|
|
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>
|
@@ -114,9 +114,9 @@
|
|
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>
|
@@ -124,9 +124,9 @@
|
|
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>
|
@@ -134,9 +134,9 @@
|
|
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>
|
@@ -144,7 +144,7 @@
|
|
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>
|
@@ -154,9 +154,9 @@
|
|
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>
|
@@ -164,9 +164,9 @@
|
|
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>
|
@@ -174,10 +174,10 @@
|
|
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>
|
@@ -185,9 +185,9 @@
|
|
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>
|
@@ -195,7 +195,7 @@
|
|
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>
|
@@ -205,9 +205,9 @@
|
|
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>
|
@@ -215,9 +215,9 @@
|
|
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>
|
@@ -225,9 +225,9 @@
|
|
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>
|
@@ -235,9 +235,9 @@
|
|
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>
|
@@ -245,9 +245,9 @@
|
|
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>
|
@@ -255,9 +255,9 @@
|
|
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>
|
@@ -265,9 +265,9 @@
|
|
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>
|
@@ -275,42 +275,11 @@
|
|
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>
|
@@ -327,23 +296,40 @@
|
|
327 |
</segment_analytics>
|
328 |
</helpers>
|
329 |
</global>
|
330 |
-
|
331 |
<default>
|
332 |
<segment_analytics>
|
333 |
<options>
|
334 |
<customer_traits>
|
335 |
created_at
|
|
|
336 |
email
|
337 |
-
first_name
|
338 |
last_name
|
339 |
middle_name
|
340 |
name
|
341 |
is_active
|
342 |
updated_at
|
343 |
total_orders
|
344 |
-
total_spent
|
345 |
</customer_traits>
|
346 |
</options>
|
347 |
</segment_analytics>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
</default>
|
|
|
|
|
349 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Segment_Analytics>
|
5 |
+
<version>2.0.0</version>
|
6 |
</Segment_Analytics>
|
7 |
</modules>
|
8 |
<frontend>
|
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 |
|
35 |
<method>addFrotnendScripts</method>
|
36 |
</segment_analyticsmore_scripts_addfrontend>
|
37 |
</observers>
|
38 |
+
</controller_action_layout_generate_blocks_after>
|
39 |
|
40 |
<customer_login>
|
41 |
<observers>
|
43 |
<type>singleton</type>
|
44 |
<class>segment_analytics/observer</class>
|
45 |
<method>loggedIn</method>
|
46 |
+
</segment_analyticsmore_scripts>
|
47 |
</observers>
|
48 |
</customer_login>
|
49 |
|
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>
|
86 |
</segment_analyticsmore_blocks>
|
87 |
</observers>
|
88 |
</controller_action_layout_render_before>
|
89 |
+
|
90 |
<catalogsearch_query_load_after>
|
91 |
<observers>
|
92 |
<segment_analyticsmore_search>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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>
|
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 |
</events>
|
282 |
+
|
283 |
<blocks>
|
284 |
<segment_analytics>
|
285 |
<class>Segment_Analytics_Block</class>
|
296 |
</segment_analytics>
|
297 |
</helpers>
|
298 |
</global>
|
299 |
+
|
300 |
<default>
|
301 |
<segment_analytics>
|
302 |
<options>
|
303 |
<customer_traits>
|
304 |
created_at
|
305 |
+
user_id
|
306 |
email
|
307 |
+
first_name
|
308 |
last_name
|
309 |
middle_name
|
310 |
name
|
311 |
is_active
|
312 |
updated_at
|
313 |
total_orders
|
314 |
+
total_spent
|
315 |
</customer_traits>
|
316 |
</options>
|
317 |
</segment_analytics>
|
318 |
+
|
319 |
+
<segment_analytics>
|
320 |
+
<options>
|
321 |
+
<product_properties>
|
322 |
+
</product_properties>
|
323 |
+
</options>
|
324 |
+
</segment_analytics>
|
325 |
+
<segment_analytics>
|
326 |
+
<options>
|
327 |
+
<logout_flush>
|
328 |
+
0
|
329 |
+
</logout_flush>
|
330 |
+
</options>
|
331 |
+
</segment_analytics>
|
332 |
</default>
|
333 |
+
|
334 |
+
|
335 |
</config>
|
app/code/community/Segment/Analytics/etc/system.xml
CHANGED
@@ -7,7 +7,7 @@
|
|
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>
|
@@ -15,7 +15,7 @@
|
|
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 -->
|
@@ -27,8 +27,18 @@
|
|
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 |
<customer_traits>
|
33 |
<label>Customer Traits</label>
|
34 |
<comment>Which Magento Customer Data Fields to Send</comment>
|
@@ -36,10 +46,19 @@
|
|
36 |
<sort_order>20</sort_order>
|
37 |
<show_in_default>1</show_in_default>
|
38 |
<show_in_website>1</show_in_website>
|
39 |
-
<show_in_store>1</show_in_store>
|
40 |
</customer_traits>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
</fields>
|
42 |
-
</options>
|
43 |
</groups>
|
44 |
</segment_analytics>
|
45 |
</sections>
|
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>
|
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 -->
|
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 |
+
<logout_flush>
|
33 |
+
<label>Flush Analytics Cache on Customer Logout</label>
|
34 |
+
<comment>Flushing will ensure you don't misattribute events to a logged-out user. You may opt not to flush if you want to continue tracking users by ID after they logout. Click <a href="https://segment.com/docs/libraries/analytics.js/#reset-logout">here</a> for more info.</comment>
|
35 |
+
<frontend_type>select</frontend_type>
|
36 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
37 |
+
<sort_order>15</sort_order>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>1</show_in_website>
|
40 |
+
<show_in_store>1</show_in_store>
|
41 |
+
</logout_flush>
|
42 |
<customer_traits>
|
43 |
<label>Customer Traits</label>
|
44 |
<comment>Which Magento Customer Data Fields to Send</comment>
|
46 |
<sort_order>20</sort_order>
|
47 |
<show_in_default>1</show_in_default>
|
48 |
<show_in_website>1</show_in_website>
|
49 |
+
<show_in_store>1</show_in_store>
|
50 |
</customer_traits>
|
51 |
+
<product_properties>
|
52 |
+
<label>Product Properties Blacklist</label>
|
53 |
+
<comment>Which Magento Product Data Fields would you like to blacklist from properties of your calls?</comment>
|
54 |
+
<frontend_type>textarea</frontend_type>
|
55 |
+
<sort_order>30</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>1</show_in_website>
|
58 |
+
<show_in_store>1</show_in_store>
|
59 |
+
</product_properties>
|
60 |
</fields>
|
61 |
+
</options>
|
62 |
</groups>
|
63 |
</segment_analytics>
|
64 |
</sections>
|
app/design/frontend/base/default/template/segment_analytics/addtocart.phtml
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php //echo $this->renderDataAsJsonVar('segment_analytics_addtocart'); ?>
|
2 |
<script type="text/javascript">
|
3 |
-
analytics.track('Added Product',
|
|
|
4 |
<?php echo $this->getContextJson(); ?>);
|
5 |
</script>
|
1 |
<?php //echo $this->renderDataAsJsonVar('segment_analytics_addtocart'); ?>
|
2 |
<script type="text/javascript">
|
3 |
+
analytics.track('Added Product',
|
4 |
+
<?php echo $this->renderDataAsJsonObject('product'); ?>,
|
5 |
<?php echo $this->getContextJson(); ?>);
|
6 |
</script>
|
app/design/frontend/base/default/template/segment_analytics/customerloggedout.phtml
CHANGED
@@ -1,5 +1,9 @@
|
|
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>
|
1 |
+
<?php //echo $this->renderDataAsJsonVar('segment_analytics_customerloggedout');
|
2 |
+
$flush = Mage::helper('segment_analytics')->flushAfterLogout();
|
3 |
+
?>
|
4 |
<script type="text/javascript">
|
5 |
analytics.track('Logged Out',{},
|
6 |
+
<?php echo $this->getContextJson(); ?>, function() {
|
7 |
+
<?php if ($flush) { echo 'analytics.reset()'; } ?>
|
8 |
+
});
|
9 |
</script>
|
app/design/frontend/base/default/template/segment_analytics/identity.phtml
CHANGED
@@ -1,17 +1,19 @@
|
|
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>
|
1 |
<?php
|
2 |
//echo $this->renderDataAsJsonVar('segment_analytics_identity');
|
3 |
+
|
4 |
$json_to_send = Mage::helper('core')->jsonDecode($this->renderDataAsJsonObject());
|
5 |
unset($json_to_send['key']);
|
6 |
unset($json_to_send['user_id']);
|
7 |
+
|
8 |
if(array_key_exists('gender', $json_to_send) && $json_to_send['gender'] === false)
|
9 |
{
|
10 |
unset($json_to_send['gender']);
|
11 |
}
|
12 |
+
$json_to_send = Mage::helper('core')->jsonEncode($json_to_send);
|
13 |
?>
|
14 |
<script type="text/javascript">
|
15 |
+
analytics.identify(<?php echo $this->getPropertyAsJavascriptString('user_id');?>,
|
16 |
<?php echo $json_to_send; ?>,
|
17 |
<?php echo $this->getContextJson(); ?>);
|
18 |
+
|
19 |
</script>
|
app/design/frontend/base/default/template/segment_analytics/removefromcart.phtml
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php //echo $this->renderDataAsJsonVar('segment_analytics_removefromcart'); ?>
|
2 |
<script type="text/javascript">
|
3 |
-
analytics.track('
|
4 |
-
|
|
|
5 |
</script>
|
1 |
<?php //echo $this->renderDataAsJsonVar('segment_analytics_removefromcart'); ?>
|
2 |
<script type="text/javascript">
|
3 |
+
analytics.track('Added Product',
|
4 |
+
<?php echo $this->renderDataAsJsonObject('product'); ?>,
|
5 |
+
<?php echo $this->getContextJson(); ?>);
|
6 |
</script>
|
package.xml
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<package><name>analytics</name><version>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<package><name>analytics</name><version>2.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>2015-09-01</date><time>21:54:54</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="58a1ee8a97092b0e0414183989e3b273"/><file name="system.xml" hash="a745c1dbe5d9333a58b7cf7a6e7ceb7a"/></dir><dir name="Helper"><file name="Data.php" hash="b8ae3d96c1d28afe773ffc0e581c0d2e"/></dir><dir name="Model"><file name="Observer.php" hash="9e348fb5c96a2e07571c11547e245554"/><file name="Session.php" hash="b704f5a8e83a1e88710cce75c14ca8b2"/><dir name="Controller"><file name="Addedtowishlist.php" hash="d7554a3dfeba4389403da77cd8b9b577"/><file name="Addtocart.php" hash="1f3d616574e893384e8bc1d7c9be24f3"/><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="b62011136bff4bd4ffcece4f89e1c5f3"/><file name="Customerregistered.php" hash="bab7b09c54e80aea887b762730bace85"/><file name="Filteredproducts.php" hash="d9f5aa27812bcb2707765c8295daa33d"/><file name="Identity.php" hash="21ab2b0330c9e0b08b73e8fe643322f8"/><file name="Init.php" hash="880bd8d529a07f6a04616e2c98664fe8"/><file name="Layerednavfilter.php" hash="e687405d3e661929fd8ddaf07d1a4e34"/><file name="Orderplaced.php" hash="184d0591c167a9b134d43e7cd39df3cf"/><file name="Page.php" hash="1877a140c41d0fffa30f691fe19ca807"/><file name="Removefromcart.php" hash="49c69353991c5477eb8fa6d845c978c2"/><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="79fdf309e9be6cfa414c76aabff01d03"/><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="0a68687ebe8c5ca880387489f1ea2670"/></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="255717ea240821659740e0277971a56b"/><file name="alias.phtml" hash="3e2f76491ca3870b7145d95613489515"/><file name="amlistfav.phtml" hash="8950bdf6d8bf6a758c3a27261dbcfeea"/><file name="customerloggedin.phtml" hash="b6459b72a3af74500c3e0fd600b9b66d"/><file name="customerloggedout.phtml" hash="301129446323a55d7ae1e6cd62603fba"/><file name="customerregistered.phtml" hash="2ae49ebdc261a2ac12666e3f8c88007b"/><file name="filteredproducts.phtml" hash="7bfea3e857aa5cf94d80ac560569215c"/><file name="identity.phtml" hash="de92c0c1f9ee5667188b462d8bae8a33"/><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="e50ce55425f8b2725ae22a675e10d575"/><file name="removefromcart.phtml" hash="081276a9ba92dfea39d96ee23ceb52d4"/><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>
|