Version Notes
New Features
- routes can now be enabled/disabled
- support for ajax add to cart
- category name from page title option
- advanced debug
Fixed
- mapping of routes with underscores
- category name on product pages
Download this release
Release Info
Developer | Hadar Paz |
Extension | Inside_Analytics |
Version | 2.3.1 |
Comparing to | |
See all releases |
Code changes from version 2.2.0 to 2.3.1
- app/code/community/Inside/Analytics/Block/Adminhtml/System/Config/Form/Button/Clearlog.php +49 -0
- app/code/community/Inside/Analytics/Block/Adminhtml/System/Config/Form/Button/Showlog.php +49 -0
- app/code/community/Inside/Analytics/Block/Analytics.php +33 -5
- app/code/community/Inside/Analytics/Helper/Data.php +55 -1
- app/code/community/Inside/Analytics/Model/Observer.php +14 -2
- app/code/community/Inside/Analytics/Model/PageView.php +43 -20
- app/code/community/Inside/Analytics/Model/PageView/Type.php +33 -27
- app/code/community/Inside/Analytics/Model/Route.php +15 -0
- app/code/community/Inside/Analytics/controllers/Adminhtml/DebugController.php +54 -0
- app/code/community/Inside/Analytics/etc/config.xml +1 -1
- app/code/community/Inside/Analytics/etc/system.xml +55 -8
- package.xml +13 -5
app/code/community/Inside/Analytics/Block/Adminhtml/System/Config/Form/Button/Clearlog.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of class...
|
5 |
+
*
|
6 |
+
* @category Inside
|
7 |
+
* @package Inside_Analytics
|
8 |
+
* @author Inside <martin.novak@inside.tm>
|
9 |
+
*/
|
10 |
+
class Inside_Analytics_Block_Adminhtml_System_Config_Form_Button_Clearlog
|
11 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
12 |
+
{
|
13 |
+
/*
|
14 |
+
* Set template
|
15 |
+
*/
|
16 |
+
protected function _construct()
|
17 |
+
{
|
18 |
+
parent::_construct();
|
19 |
+
$this->setTemplate('inside/system/config/button.phtml');
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Return element html
|
24 |
+
*
|
25 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
26 |
+
* @return string
|
27 |
+
*/
|
28 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
29 |
+
{
|
30 |
+
return $this->_toHtml();
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Generate button html
|
35 |
+
*
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
public function getButtonHtml()
|
39 |
+
{
|
40 |
+
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
41 |
+
->setData(array(
|
42 |
+
'id' => 'clear_button',
|
43 |
+
'label' => $this->helper('adminhtml')->__('Clear Log File'),
|
44 |
+
'onclick' => "window.location = '".$this->getUrl('inside/adminhtml_debug/clearlog')."';"
|
45 |
+
));
|
46 |
+
|
47 |
+
return $button->toHtml();
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Inside/Analytics/Block/Adminhtml/System/Config/Form/Button/Showlog.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of class...
|
5 |
+
*
|
6 |
+
* @category Inside
|
7 |
+
* @package Inside_Analytics
|
8 |
+
* @author Inside <martin.novak@inside.tm>
|
9 |
+
*/
|
10 |
+
class Inside_Analytics_Block_Adminhtml_System_Config_Form_Button_Showlog
|
11 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
12 |
+
{
|
13 |
+
/*
|
14 |
+
* Set template
|
15 |
+
*/
|
16 |
+
protected function _construct()
|
17 |
+
{
|
18 |
+
parent::_construct();
|
19 |
+
$this->setTemplate('inside/system/config/button.phtml');
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Return element html
|
24 |
+
*
|
25 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
26 |
+
* @return string
|
27 |
+
*/
|
28 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
29 |
+
{
|
30 |
+
return $this->_toHtml();
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Generate button html
|
35 |
+
*
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
public function getButtonHtml()
|
39 |
+
{
|
40 |
+
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
41 |
+
->setData(array(
|
42 |
+
'id' => 'showlog_button',
|
43 |
+
'label' => $this->helper('adminhtml')->__('Show Log File Content'),
|
44 |
+
'onclick' => "window.open('".$this->getUrl('inside/adminhtml_debug/showlog')."');"
|
45 |
+
));
|
46 |
+
|
47 |
+
return $button->toHtml();
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Inside/Analytics/Block/Analytics.php
CHANGED
@@ -22,6 +22,9 @@ class Inside_Analytics_Block_Analytics extends Mage_Core_Block_Template
|
|
22 |
*/
|
23 |
public function getPageName()
|
24 |
{
|
|
|
|
|
|
|
25 |
return $this->_getData('page_name');
|
26 |
}
|
27 |
|
@@ -33,9 +36,17 @@ class Inside_Analytics_Block_Analytics extends Mage_Core_Block_Template
|
|
33 |
*/
|
34 |
protected function _getAccountCode()
|
35 |
{
|
|
|
|
|
36 |
$accountId = Mage::getStoreConfig(Inside_Analytics_Helper_Data::XML_PATH_ACCOUNT);
|
37 |
$visitorId = Mage::helper('inside')->getVisitorId();
|
38 |
$visitorName = Mage::helper('inside')->getVisitorName();
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
return "_inside.push({
|
40 |
'action': 'getTracker', 'account': '{$this->jsQuoteEscape($accountId)}'{$visitorId}{$visitorName}
|
41 |
});
|
@@ -49,6 +60,8 @@ class Inside_Analytics_Block_Analytics extends Mage_Core_Block_Template
|
|
49 |
*/
|
50 |
protected function _getPageTrackingCode()
|
51 |
{
|
|
|
|
|
52 |
$script = "_inside.push({";
|
53 |
$data = Mage::getModel('inside/pageView')->getPageTrackCodeData($this->_requestArray);
|
54 |
foreach ($data as $key => $val) {
|
@@ -57,6 +70,8 @@ class Inside_Analytics_Block_Analytics extends Mage_Core_Block_Template
|
|
57 |
}
|
58 |
$script .= '\''.$key.'\':\''. addslashes($val).'\',';
|
59 |
}
|
|
|
|
|
60 |
|
61 |
return substr($script, 0, strlen($script)-1) . "});";
|
62 |
}
|
@@ -68,6 +83,8 @@ class Inside_Analytics_Block_Analytics extends Mage_Core_Block_Template
|
|
68 |
*/
|
69 |
protected function _getOrdersTrackingCode()
|
70 |
{
|
|
|
|
|
71 |
$script = '';
|
72 |
$data = Mage::getModel('inside/pageView')->getOrderTrackCodeData($this->_requestArray);
|
73 |
if (!empty($data)) {
|
@@ -82,6 +99,10 @@ class Inside_Analytics_Block_Analytics extends Mage_Core_Block_Template
|
|
82 |
$script = substr($script, 0, strlen($script)-1) . "});";
|
83 |
}
|
84 |
}
|
|
|
|
|
|
|
|
|
85 |
return $script;
|
86 |
}
|
87 |
|
@@ -92,6 +113,8 @@ class Inside_Analytics_Block_Analytics extends Mage_Core_Block_Template
|
|
92 |
*/
|
93 |
protected function _getSaleTrackingCode()
|
94 |
{
|
|
|
|
|
95 |
$orderIds = $this->getOrderIds();
|
96 |
if (empty($orderIds) || !is_array($orderIds)) {
|
97 |
return;
|
@@ -108,6 +131,10 @@ class Inside_Analytics_Block_Analytics extends Mage_Core_Block_Template
|
|
108 |
'orderTotal':'{$order->getGrandTotal()}',
|
109 |
'complete':'true'});";
|
110 |
}
|
|
|
|
|
|
|
|
|
111 |
return $script;
|
112 |
}
|
113 |
|
@@ -131,10 +158,9 @@ class Inside_Analytics_Block_Analytics extends Mage_Core_Block_Template
|
|
131 |
*/
|
132 |
protected function _toHtml()
|
133 |
{
|
134 |
-
|
135 |
return $this->_getDebugCode();
|
136 |
}
|
137 |
-
|
138 |
return parent::_toHtml();
|
139 |
}
|
140 |
|
@@ -142,17 +168,19 @@ class Inside_Analytics_Block_Analytics extends Mage_Core_Block_Template
|
|
142 |
* Load current request route params
|
143 |
*/
|
144 |
protected function _prepareLayout() {
|
|
|
|
|
145 |
parent::_prepareLayout();
|
146 |
$action = Mage::app()->getFrontController()->getAction();
|
|
|
147 |
if ($action) {
|
148 |
$this->_requestArray = array(
|
149 |
'module' => $action->getRequest()->getRequestedRouteName(),
|
150 |
'controller' => $action->getRequest()->getRequestedControllerName(),
|
151 |
'action' => $action->getRequest()->getRequestedActionName()
|
152 |
);
|
153 |
-
|
154 |
-
Mage::log($this->_requestArray, null, 'inside-analytics.log', true);
|
155 |
-
}
|
156 |
}
|
|
|
157 |
}
|
158 |
}
|
22 |
*/
|
23 |
public function getPageName()
|
24 |
{
|
25 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
26 |
+
Mage::helper('inside')->log('Page name:'.$this->_getData('page_name'), true);
|
27 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
28 |
return $this->_getData('page_name');
|
29 |
}
|
30 |
|
36 |
*/
|
37 |
protected function _getAccountCode()
|
38 |
{
|
39 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
40 |
+
|
41 |
$accountId = Mage::getStoreConfig(Inside_Analytics_Helper_Data::XML_PATH_ACCOUNT);
|
42 |
$visitorId = Mage::helper('inside')->getVisitorId();
|
43 |
$visitorName = Mage::helper('inside')->getVisitorName();
|
44 |
+
|
45 |
+
Mage::helper('inside')->log('$accountId:'.$accountId, true);
|
46 |
+
Mage::helper('inside')->log('$visitorId:'.$visitorId, true);
|
47 |
+
Mage::helper('inside')->log('$visitorName:'.$visitorName, true);
|
48 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
49 |
+
|
50 |
return "_inside.push({
|
51 |
'action': 'getTracker', 'account': '{$this->jsQuoteEscape($accountId)}'{$visitorId}{$visitorName}
|
52 |
});
|
60 |
*/
|
61 |
protected function _getPageTrackingCode()
|
62 |
{
|
63 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
64 |
+
|
65 |
$script = "_inside.push({";
|
66 |
$data = Mage::getModel('inside/pageView')->getPageTrackCodeData($this->_requestArray);
|
67 |
foreach ($data as $key => $val) {
|
70 |
}
|
71 |
$script .= '\''.$key.'\':\''. addslashes($val).'\',';
|
72 |
}
|
73 |
+
Mage::helper('inside')->log('$script: '.$script, true);
|
74 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
75 |
|
76 |
return substr($script, 0, strlen($script)-1) . "});";
|
77 |
}
|
83 |
*/
|
84 |
protected function _getOrdersTrackingCode()
|
85 |
{
|
86 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
87 |
+
|
88 |
$script = '';
|
89 |
$data = Mage::getModel('inside/pageView')->getOrderTrackCodeData($this->_requestArray);
|
90 |
if (!empty($data)) {
|
99 |
$script = substr($script, 0, strlen($script)-1) . "});";
|
100 |
}
|
101 |
}
|
102 |
+
|
103 |
+
Mage::helper('inside')->log('$script: '.$script, true);
|
104 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
105 |
+
|
106 |
return $script;
|
107 |
}
|
108 |
|
113 |
*/
|
114 |
protected function _getSaleTrackingCode()
|
115 |
{
|
116 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
117 |
+
|
118 |
$orderIds = $this->getOrderIds();
|
119 |
if (empty($orderIds) || !is_array($orderIds)) {
|
120 |
return;
|
131 |
'orderTotal':'{$order->getGrandTotal()}',
|
132 |
'complete':'true'});";
|
133 |
}
|
134 |
+
|
135 |
+
Mage::helper('inside')->log('$script: '.$script, true);
|
136 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
137 |
+
|
138 |
return $script;
|
139 |
}
|
140 |
|
158 |
*/
|
159 |
protected function _toHtml()
|
160 |
{
|
161 |
+
if (!Mage::helper('inside')->isInsideAnalyticsAvailable() || !is_array($this->_requestArray)) {
|
162 |
return $this->_getDebugCode();
|
163 |
}
|
|
|
164 |
return parent::_toHtml();
|
165 |
}
|
166 |
|
168 |
* Load current request route params
|
169 |
*/
|
170 |
protected function _prepareLayout() {
|
171 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
172 |
+
|
173 |
parent::_prepareLayout();
|
174 |
$action = Mage::app()->getFrontController()->getAction();
|
175 |
+
|
176 |
if ($action) {
|
177 |
$this->_requestArray = array(
|
178 |
'module' => $action->getRequest()->getRequestedRouteName(),
|
179 |
'controller' => $action->getRequest()->getRequestedControllerName(),
|
180 |
'action' => $action->getRequest()->getRequestedActionName()
|
181 |
);
|
182 |
+
Mage::helper('inside')->log('$this->_requestArray: '.print_r($this->_requestArray, true));
|
|
|
|
|
183 |
}
|
184 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
185 |
}
|
186 |
}
|
app/code/community/Inside/Analytics/Helper/Data.php
CHANGED
@@ -12,10 +12,13 @@ class Inside_Analytics_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
12 |
/**
|
13 |
* Config paths for using throughout the code
|
14 |
*/
|
|
|
15 |
const XML_PATH_ACTIVE = 'inside/analytics/active';
|
16 |
const XML_PATH_ACCOUNT = 'inside/analytics/account';
|
17 |
const XML_LOG_ACTIVE = 'inside/debug/log';
|
|
|
18 |
const XML_SHOW_REQUEST = 'inside/debug/show';
|
|
|
19 |
|
20 |
const REQUEST_PART_MODULE = 'module';
|
21 |
const REQUEST_PART_CONTROLLER = 'controller';
|
@@ -75,6 +78,15 @@ class Inside_Analytics_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
75 |
*/
|
76 |
public function getProductImageUrl(Mage_Catalog_Model_Product $product)
|
77 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
return sprintf('%s', Mage::helper('catalog/image')->init($product, 'thumbnail')->resize(256));
|
79 |
}
|
80 |
|
@@ -110,7 +122,7 @@ class Inside_Analytics_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
110 |
*
|
111 |
* @return array
|
112 |
*/
|
113 |
-
public function
|
114 |
{
|
115 |
$title = explode(' - ', Mage::app()->getLayout()->getBlock('head')->getTitle());
|
116 |
return $title;
|
@@ -127,6 +139,35 @@ class Inside_Analytics_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
127 |
return Mage::getStoreConfigFlag(self::XML_LOG_ACTIVE, $store);
|
128 |
}
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
/**
|
131 |
* Can request array be shown?
|
132 |
*
|
@@ -138,6 +179,19 @@ class Inside_Analytics_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
138 |
return Mage::getStoreConfigFlag(self::XML_SHOW_REQUEST, $store);
|
139 |
}
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
/**
|
142 |
* Returns all search parameter names available
|
143 |
*
|
12 |
/**
|
13 |
* Config paths for using throughout the code
|
14 |
*/
|
15 |
+
const LOG_FILENAME = 'inside-analytics.log';
|
16 |
const XML_PATH_ACTIVE = 'inside/analytics/active';
|
17 |
const XML_PATH_ACCOUNT = 'inside/analytics/account';
|
18 |
const XML_LOG_ACTIVE = 'inside/debug/log';
|
19 |
+
const XML_LOG_VERBOSE = 'inside/debug/verbose';
|
20 |
const XML_SHOW_REQUEST = 'inside/debug/show';
|
21 |
+
const XML_CATEGORY_FROM_TITLE = 'inside/options/category_title';
|
22 |
|
23 |
const REQUEST_PART_MODULE = 'module';
|
24 |
const REQUEST_PART_CONTROLLER = 'controller';
|
78 |
*/
|
79 |
public function getProductImageUrl(Mage_Catalog_Model_Product $product)
|
80 |
{
|
81 |
+
if($product->getImage() == 'no_selection') {
|
82 |
+
//try to get image from parent configurable product
|
83 |
+
$_parentIdArray = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
|
84 |
+
if(sizeof($_parentIdArray) >=1 && Mage::getModel('catalog/product')->load($_parentIdArray[0])->getTypeId() == 'configurable')
|
85 |
+
{
|
86 |
+
$product = Mage::getModel('catalog/product')->load($_parentIdArray[0]);
|
87 |
+
}
|
88 |
+
|
89 |
+
}
|
90 |
return sprintf('%s', Mage::helper('catalog/image')->init($product, 'thumbnail')->resize(256));
|
91 |
}
|
92 |
|
122 |
*
|
123 |
* @return array
|
124 |
*/
|
125 |
+
public function getCategoryFromTitle()
|
126 |
{
|
127 |
$title = explode(' - ', Mage::app()->getLayout()->getBlock('head')->getTitle());
|
128 |
return $title;
|
139 |
return Mage::getStoreConfigFlag(self::XML_LOG_ACTIVE, $store);
|
140 |
}
|
141 |
|
142 |
+
/**
|
143 |
+
* Is verbose log option enabled?
|
144 |
+
*
|
145 |
+
* @param int $store
|
146 |
+
* @return boolean
|
147 |
+
*/
|
148 |
+
public function isVerboseEnabled($store = null)
|
149 |
+
{
|
150 |
+
return Mage::getStoreConfigFlag(self::XML_LOG_VERBOSE, $store);
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Wrapper for Magentos' own log function
|
155 |
+
*
|
156 |
+
* @param mixed $data
|
157 |
+
* @param boolean $verbose
|
158 |
+
* @param int $store
|
159 |
+
*/
|
160 |
+
public function log($data, $verbose = false, $store = null)
|
161 |
+
{
|
162 |
+
if ($this->isLoggingEnabled($store)) {
|
163 |
+
if ($verbose === false || ($verbose && $this->isVerboseEnabled($store))) {
|
164 |
+
$ip = Mage::helper('core/http')->getRemoteAddr();
|
165 |
+
$log = $ip ? $ip .'|'. $data : $data;
|
166 |
+
Mage::log($log, null, self::LOG_FILENAME, true);
|
167 |
+
}
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
/**
|
172 |
* Can request array be shown?
|
173 |
*
|
179 |
return Mage::getStoreConfigFlag(self::XML_SHOW_REQUEST, $store);
|
180 |
}
|
181 |
|
182 |
+
/**
|
183 |
+
|
184 |
+
* @param mixed $store
|
185 |
+
* @return boolean * Build category name from page title?
|
186 |
+
*
|
187 |
+
* @param mixed $store
|
188 |
+
* @return boolean
|
189 |
+
*/
|
190 |
+
public function buildCategoryFromTitle($store = null)
|
191 |
+
{
|
192 |
+
return Mage::getStoreConfigFlag(self::XML_CATEGORY_FROM_TITLE, $store);
|
193 |
+
}
|
194 |
+
|
195 |
/**
|
196 |
* Returns all search parameter names available
|
197 |
*
|
app/code/community/Inside/Analytics/Model/Observer.php
CHANGED
@@ -11,14 +11,20 @@ class Inside_Analytics_Model_Observer {
|
|
11 |
|
12 |
public function setOrderSuccessPageView(Varien_Event_Observer $observer)
|
13 |
{
|
|
|
14 |
$orderIds = $observer->getEvent()->getOrderIds();
|
15 |
-
|
|
|
|
|
|
|
16 |
return;
|
17 |
}
|
18 |
$block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('inside_analytics');
|
19 |
if ($block) {
|
20 |
$block->setOrderIds($orderIds);
|
21 |
}
|
|
|
|
|
22 |
}
|
23 |
|
24 |
/**
|
@@ -28,12 +34,14 @@ class Inside_Analytics_Model_Observer {
|
|
28 |
*/
|
29 |
public function setAjax(Varien_Event_Observer $observer)
|
30 |
{
|
|
|
|
|
31 |
$frontController = $observer->getEvent()->getFront();
|
32 |
/* @var $frontController Mage_Core_Controller_Varien_Front */
|
33 |
$routes = Mage::getResourceModel('inside/route_collection')
|
34 |
->addFieldToFilter('is_active', 1)
|
35 |
->addFieldToFilter('is_ajax', 1);
|
36 |
-
|
37 |
foreach ($routes as $route) {
|
38 |
/* @var $route Inside_Analytics_Model_Route */
|
39 |
if ($route->matches(
|
@@ -41,9 +49,13 @@ class Inside_Analytics_Model_Observer {
|
|
41 |
$frontController->getRequest()->getControllerName(),
|
42 |
$frontController->getRequest()->getActionName()
|
43 |
)) {
|
|
|
44 |
Mage::getSingleton('core/session')->setInsideUpdateOnNext(true);
|
|
|
|
|
45 |
}
|
46 |
}
|
|
|
47 |
}
|
48 |
}
|
49 |
|
11 |
|
12 |
public function setOrderSuccessPageView(Varien_Event_Observer $observer)
|
13 |
{
|
14 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
15 |
$orderIds = $observer->getEvent()->getOrderIds();
|
16 |
+
Mage::helper('inside')->log('$orderIds: '.$orderIds, true);
|
17 |
+
|
18 |
+
if (empty($orderIds) || !is_array($orderIds)) {
|
19 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
20 |
return;
|
21 |
}
|
22 |
$block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('inside_analytics');
|
23 |
if ($block) {
|
24 |
$block->setOrderIds($orderIds);
|
25 |
}
|
26 |
+
|
27 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
28 |
}
|
29 |
|
30 |
/**
|
34 |
*/
|
35 |
public function setAjax(Varien_Event_Observer $observer)
|
36 |
{
|
37 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
38 |
+
|
39 |
$frontController = $observer->getEvent()->getFront();
|
40 |
/* @var $frontController Mage_Core_Controller_Varien_Front */
|
41 |
$routes = Mage::getResourceModel('inside/route_collection')
|
42 |
->addFieldToFilter('is_active', 1)
|
43 |
->addFieldToFilter('is_ajax', 1);
|
44 |
+
Mage::helper('inside')->log('# OF ROUTES: '.$routes->count(), true);
|
45 |
foreach ($routes as $route) {
|
46 |
/* @var $route Inside_Analytics_Model_Route */
|
47 |
if ($route->matches(
|
49 |
$frontController->getRequest()->getControllerName(),
|
50 |
$frontController->getRequest()->getActionName()
|
51 |
)) {
|
52 |
+
Mage::helper('inside')->log('Route ID '. $route->getId() . ' AJAX REQUEST MATCH --> setting ajax session variable.', true);
|
53 |
Mage::getSingleton('core/session')->setInsideUpdateOnNext(true);
|
54 |
+
} else {
|
55 |
+
Mage::helper('inside')->log('Route ID '. $route->getId() . ' AJAX REQUEST DOES NOT MATCH', true);
|
56 |
}
|
57 |
}
|
58 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
59 |
}
|
60 |
}
|
61 |
|
app/code/community/Inside/Analytics/Model/PageView.php
CHANGED
@@ -25,17 +25,19 @@ class Inside_Analytics_Model_PageView extends Mage_Core_Model_Abstract {
|
|
25 |
protected $_category = null;
|
26 |
|
27 |
/**
|
28 |
-
*
|
|
|
29 |
*
|
30 |
* @var boolean
|
31 |
*/
|
32 |
-
protected $
|
33 |
|
34 |
|
35 |
public function _construct()
|
36 |
{
|
37 |
parent::_construct();
|
38 |
$this->_pageViewType = Mage::getModel('inside/pageView_type');
|
|
|
39 |
$this->_loadProduct()->_loadCategory();
|
40 |
}
|
41 |
|
@@ -47,7 +49,8 @@ class Inside_Analytics_Model_PageView extends Mage_Core_Model_Abstract {
|
|
47 |
*/
|
48 |
public function getPageTrackCodeData($requestArray)
|
49 |
{
|
50 |
-
|
|
|
51 |
$type = $this->_pageViewType->getPageType($requestArray);
|
52 |
$common = array(
|
53 |
'action' => 'trackView',
|
@@ -55,9 +58,15 @@ class Inside_Analytics_Model_PageView extends Mage_Core_Model_Abstract {
|
|
55 |
'name' => $this->_pageViewType->getPageName($type),
|
56 |
'orderId' => $this->_getOrderId(),
|
57 |
'orderTotal' => $this->_getOrderTotal(),
|
58 |
-
'shippingTotal' => $this->_getShippingTotal()
|
|
|
59 |
);
|
60 |
$pageSpecificData = $this->_getPageSpecificByType($type);
|
|
|
|
|
|
|
|
|
|
|
61 |
return array_merge($common, $pageSpecificData);
|
62 |
}
|
63 |
|
@@ -69,8 +78,14 @@ class Inside_Analytics_Model_PageView extends Mage_Core_Model_Abstract {
|
|
69 |
*/
|
70 |
public function getOrderTrackCodeData($requestArray)
|
71 |
{
|
|
|
|
|
72 |
$items = array();
|
73 |
$type = $this->_pageViewType->getPageType($requestArray);
|
|
|
|
|
|
|
|
|
74 |
if (($type == Inside_Analytics_Model_System_Config_Source_Page_Type::CHECKOUT || $this->_isForcedOrderUpdate())
|
75 |
&& $this->_getQuote()->getItemsCount() > 0)
|
76 |
{
|
@@ -99,6 +114,7 @@ class Inside_Analytics_Model_PageView extends Mage_Core_Model_Abstract {
|
|
99 |
if ($this->_isForcedOrderUpdate()) {
|
100 |
$this->_resetSession();
|
101 |
}
|
|
|
102 |
return $items;
|
103 |
}
|
104 |
|
@@ -111,11 +127,14 @@ class Inside_Analytics_Model_PageView extends Mage_Core_Model_Abstract {
|
|
111 |
*/
|
112 |
protected function _getPageSpecificByType($type)
|
113 |
{
|
|
|
|
|
|
|
114 |
$extra = array();
|
115 |
switch ($type) {
|
116 |
case Inside_Analytics_Model_System_Config_Source_Page_Type::CATEGORY:
|
117 |
-
if ($this->
|
118 |
-
$categoryArr = array_reverse(Mage::helper('inside')->
|
119 |
$extra['name'] = array_pop($categoryArr);
|
120 |
$extra['category'] = implode(' / ', $categoryArr);
|
121 |
if (empty($extra['name']) && $this->_category instanceof Mage_Catalog_Model_Category) {
|
@@ -157,6 +176,8 @@ class Inside_Analytics_Model_PageView extends Mage_Core_Model_Abstract {
|
|
157 |
break;
|
158 |
|
159 |
}
|
|
|
|
|
160 |
return $extra;
|
161 |
}
|
162 |
|
@@ -170,6 +191,9 @@ class Inside_Analytics_Model_PageView extends Mage_Core_Model_Abstract {
|
|
170 |
*/
|
171 |
protected function _getPageUniqueId($type)
|
172 |
{
|
|
|
|
|
|
|
173 |
$id = null;
|
174 |
switch ($type) {
|
175 |
case Inside_Analytics_Model_System_Config_Source_Page_Type::CATEGORY:
|
@@ -183,9 +207,17 @@ class Inside_Analytics_Model_PageView extends Mage_Core_Model_Abstract {
|
|
183 |
}
|
184 |
break;
|
185 |
}
|
|
|
|
|
|
|
186 |
return $id;
|
187 |
}
|
188 |
|
|
|
|
|
|
|
|
|
|
|
189 |
/**
|
190 |
* Get checkout quote instance by current session
|
191 |
*
|
@@ -261,20 +293,6 @@ class Inside_Analytics_Model_PageView extends Mage_Core_Model_Abstract {
|
|
261 |
return $this;
|
262 |
}
|
263 |
|
264 |
-
/**
|
265 |
-
* Checks for Amasty improved navigation extension
|
266 |
-
*
|
267 |
-
* @param array $requestArr
|
268 |
-
* @return \Inside_Analytics_Model_PageView
|
269 |
-
*/
|
270 |
-
protected function _setAmasty($requestArr)
|
271 |
-
{
|
272 |
-
if ($requestArr[Inside_Analytics_Helper_Data::REQUEST_PART_MODULE] == 'amshopby') {
|
273 |
-
$this->_isAmasty = true;
|
274 |
-
}
|
275 |
-
return $this;
|
276 |
-
}
|
277 |
-
|
278 |
/**
|
279 |
* Check if we have outstanding Ajax add-to-cart call
|
280 |
*
|
@@ -282,6 +300,9 @@ class Inside_Analytics_Model_PageView extends Mage_Core_Model_Abstract {
|
|
282 |
*/
|
283 |
protected function _isForcedOrderUpdate()
|
284 |
{
|
|
|
|
|
|
|
285 |
return Mage::getSingleton('core/session')->getInsideUpdateOnNext() === true;
|
286 |
}
|
287 |
|
@@ -290,7 +311,9 @@ class Inside_Analytics_Model_PageView extends Mage_Core_Model_Abstract {
|
|
290 |
*/
|
291 |
protected function _resetSession()
|
292 |
{
|
|
|
293 |
Mage::getSingleton('core/session')->unsetData('inside_update_on_next');
|
|
|
294 |
}
|
295 |
|
296 |
}
|
25 |
protected $_category = null;
|
26 |
|
27 |
/**
|
28 |
+
* Build category name from page title
|
29 |
+
* (applies to Amasty Improved Navigation and similar modules)
|
30 |
*
|
31 |
* @var boolean
|
32 |
*/
|
33 |
+
protected $_categoryFromTitle = false;
|
34 |
|
35 |
|
36 |
public function _construct()
|
37 |
{
|
38 |
parent::_construct();
|
39 |
$this->_pageViewType = Mage::getModel('inside/pageView_type');
|
40 |
+
$this->_categoryFromTitle = Mage::helper('inside')->buildCategoryFromTitle();
|
41 |
$this->_loadProduct()->_loadCategory();
|
42 |
}
|
43 |
|
49 |
*/
|
50 |
public function getPageTrackCodeData($requestArray)
|
51 |
{
|
52 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
53 |
+
|
54 |
$type = $this->_pageViewType->getPageType($requestArray);
|
55 |
$common = array(
|
56 |
'action' => 'trackView',
|
58 |
'name' => $this->_pageViewType->getPageName($type),
|
59 |
'orderId' => $this->_getOrderId(),
|
60 |
'orderTotal' => $this->_getOrderTotal(),
|
61 |
+
'shippingTotal' => $this->_getShippingTotal(),
|
62 |
+
'tags' => $this->_getTags(),
|
63 |
);
|
64 |
$pageSpecificData = $this->_getPageSpecificByType($type);
|
65 |
+
|
66 |
+
Mage::helper('inside')->log('$pageSpecificData: '.print_r($pageSpecificData, true), true);
|
67 |
+
Mage::helper('inside')->log('$common: '.print_r($common, true), true);
|
68 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
69 |
+
|
70 |
return array_merge($common, $pageSpecificData);
|
71 |
}
|
72 |
|
78 |
*/
|
79 |
public function getOrderTrackCodeData($requestArray)
|
80 |
{
|
81 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
82 |
+
|
83 |
$items = array();
|
84 |
$type = $this->_pageViewType->getPageType($requestArray);
|
85 |
+
|
86 |
+
Mage::helper('inside')->log('$type: '.$type, true);
|
87 |
+
Mage::helper('inside')->log('$this->_getQuote()->getItemsCount(): '.$this->_getQuote()->getItemsCount(), true);
|
88 |
+
|
89 |
if (($type == Inside_Analytics_Model_System_Config_Source_Page_Type::CHECKOUT || $this->_isForcedOrderUpdate())
|
90 |
&& $this->_getQuote()->getItemsCount() > 0)
|
91 |
{
|
114 |
if ($this->_isForcedOrderUpdate()) {
|
115 |
$this->_resetSession();
|
116 |
}
|
117 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
118 |
return $items;
|
119 |
}
|
120 |
|
127 |
*/
|
128 |
protected function _getPageSpecificByType($type)
|
129 |
{
|
130 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
131 |
+
Mage::helper('inside')->log('$type: '.$type, true);
|
132 |
+
|
133 |
$extra = array();
|
134 |
switch ($type) {
|
135 |
case Inside_Analytics_Model_System_Config_Source_Page_Type::CATEGORY:
|
136 |
+
if ($this->_categoryFromTitle) {
|
137 |
+
$categoryArr = array_reverse(Mage::helper('inside')->getCategoryFromTitle());
|
138 |
$extra['name'] = array_pop($categoryArr);
|
139 |
$extra['category'] = implode(' / ', $categoryArr);
|
140 |
if (empty($extra['name']) && $this->_category instanceof Mage_Catalog_Model_Category) {
|
176 |
break;
|
177 |
|
178 |
}
|
179 |
+
Mage::helper('inside')->log('$extra: '.print_r($extra, true), true);
|
180 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
181 |
return $extra;
|
182 |
}
|
183 |
|
191 |
*/
|
192 |
protected function _getPageUniqueId($type)
|
193 |
{
|
194 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
195 |
+
Mage::helper('inside')->log('$type: '.$type, true);
|
196 |
+
|
197 |
$id = null;
|
198 |
switch ($type) {
|
199 |
case Inside_Analytics_Model_System_Config_Source_Page_Type::CATEGORY:
|
207 |
}
|
208 |
break;
|
209 |
}
|
210 |
+
Mage::helper('inside')->log('$id: '.$id, true);
|
211 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
212 |
+
|
213 |
return $id;
|
214 |
}
|
215 |
|
216 |
+
protected function _getTags()
|
217 |
+
{
|
218 |
+
return sprintf('language:%s', Mage::app()->getStore()->getCode());
|
219 |
+
}
|
220 |
+
|
221 |
/**
|
222 |
* Get checkout quote instance by current session
|
223 |
*
|
293 |
return $this;
|
294 |
}
|
295 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
/**
|
297 |
* Check if we have outstanding Ajax add-to-cart call
|
298 |
*
|
300 |
*/
|
301 |
protected function _isForcedOrderUpdate()
|
302 |
{
|
303 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
304 |
+
Mage::helper('inside')->log('session update on next: '.(string)Mage::getSingleton('core/session')->getInsideUpdateOnNext(), true);
|
305 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
306 |
return Mage::getSingleton('core/session')->getInsideUpdateOnNext() === true;
|
307 |
}
|
308 |
|
311 |
*/
|
312 |
protected function _resetSession()
|
313 |
{
|
314 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
315 |
Mage::getSingleton('core/session')->unsetData('inside_update_on_next');
|
316 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
317 |
}
|
318 |
|
319 |
}
|
app/code/community/Inside/Analytics/Model/PageView/Type.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
class Inside_Analytics_Model_PageView_Type extends Mage_Core_Model_Abstract {
|
11 |
|
12 |
/**
|
13 |
-
* List of page view types and associated
|
14 |
* @var array
|
15 |
*/
|
16 |
protected $_typeActions = array();
|
@@ -27,14 +27,16 @@ class Inside_Analytics_Model_PageView_Type extends Mage_Core_Model_Abstract {
|
|
27 |
*/
|
28 |
protected function _loadTrackRoutes()
|
29 |
{
|
|
|
|
|
30 |
$routes = Mage::getResourceModel('inside/route_collection')
|
31 |
->addFieldToFilter('is_active', true);
|
32 |
foreach($routes as $route) {
|
33 |
/* @var $route Inside_Analytics_Model_Route */
|
34 |
if (array_key_exists($route->getType(), $this->_typeActions)) {
|
35 |
-
$this->_typeActions[$route->getType()][] = $route
|
36 |
} else {
|
37 |
-
$this->_typeActions[$route->getType()] = array($route
|
38 |
}
|
39 |
}
|
40 |
return $this;
|
@@ -58,6 +60,8 @@ class Inside_Analytics_Model_PageView_Type extends Mage_Core_Model_Abstract {
|
|
58 |
*/
|
59 |
public function getTypeActions()
|
60 |
{
|
|
|
|
|
61 |
return $this->_typeActions;
|
62 |
}
|
63 |
|
@@ -69,32 +73,27 @@ class Inside_Analytics_Model_PageView_Type extends Mage_Core_Model_Abstract {
|
|
69 |
*/
|
70 |
public function getPageType($requestArray)
|
71 |
{
|
|
|
|
|
72 |
$fullActionName = implode('_', array_values($requestArray));
|
73 |
$match = $this->_getPageTypeExact($fullActionName);
|
74 |
-
if (!$match) {
|
75 |
-
$
|
76 |
-
foreach ($this->getTypeActions() as $type => $actions)
|
77 |
{
|
78 |
-
foreach ($
|
79 |
-
$
|
80 |
-
|
|
|
|
|
|
|
|
|
81 |
{
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
case 2: //match module and controller name
|
88 |
-
if ($_t[0] === $requestArray[Inside_Analytics_Helper_Data::REQUEST_PART_MODULE] &&
|
89 |
-
$_t[1] === $requestArray[Inside_Analytics_Helper_Data::REQUEST_PART_CONTROLLER])
|
90 |
-
{
|
91 |
-
$match = $type; $found = true;
|
92 |
-
}
|
93 |
-
break;
|
94 |
-
}
|
95 |
-
if ($found) break;
|
96 |
}
|
97 |
-
if ($found) break;
|
98 |
}
|
99 |
}
|
100 |
return $match ? $match : Inside_Analytics_Model_System_Config_Source_Page_Type::OTHER;
|
@@ -108,10 +107,15 @@ class Inside_Analytics_Model_PageView_Type extends Mage_Core_Model_Abstract {
|
|
108 |
*/
|
109 |
protected function _getPageTypeExact($key)
|
110 |
{
|
111 |
-
|
|
|
|
|
112 |
{
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
115 |
}
|
116 |
}
|
117 |
return false;
|
@@ -125,6 +129,8 @@ class Inside_Analytics_Model_PageView_Type extends Mage_Core_Model_Abstract {
|
|
125 |
*/
|
126 |
public function getPageName($type)
|
127 |
{
|
|
|
|
|
128 |
$name = 'Unknown/Untracked Page Type';
|
129 |
switch ($type) {
|
130 |
case Inside_Analytics_Model_System_Config_Source_Page_Type::HOMEPAGE:
|
10 |
class Inside_Analytics_Model_PageView_Type extends Mage_Core_Model_Abstract {
|
11 |
|
12 |
/**
|
13 |
+
* List of page view types and associated routes
|
14 |
* @var array
|
15 |
*/
|
16 |
protected $_typeActions = array();
|
27 |
*/
|
28 |
protected function _loadTrackRoutes()
|
29 |
{
|
30 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
31 |
+
|
32 |
$routes = Mage::getResourceModel('inside/route_collection')
|
33 |
->addFieldToFilter('is_active', true);
|
34 |
foreach($routes as $route) {
|
35 |
/* @var $route Inside_Analytics_Model_Route */
|
36 |
if (array_key_exists($route->getType(), $this->_typeActions)) {
|
37 |
+
$this->_typeActions[$route->getType()][] = $route;
|
38 |
} else {
|
39 |
+
$this->_typeActions[$route->getType()] = array($route);
|
40 |
}
|
41 |
}
|
42 |
return $this;
|
60 |
*/
|
61 |
public function getTypeActions()
|
62 |
{
|
63 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
64 |
+
|
65 |
return $this->_typeActions;
|
66 |
}
|
67 |
|
73 |
*/
|
74 |
public function getPageType($requestArray)
|
75 |
{
|
76 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
77 |
+
|
78 |
$fullActionName = implode('_', array_values($requestArray));
|
79 |
$match = $this->_getPageTypeExact($fullActionName);
|
80 |
+
if (!$match) {
|
81 |
+
foreach ($this->getTypeActions() as $type => $routes)
|
|
|
82 |
{
|
83 |
+
foreach ($routes as $route) {
|
84 |
+
/* @var $route Inside_Analytics_Model_Route */
|
85 |
+
if ($route->matches(
|
86 |
+
$requestArray[Inside_Analytics_Helper_Data::REQUEST_PART_MODULE],
|
87 |
+
$requestArray[Inside_Analytics_Helper_Data::REQUEST_PART_CONTROLLER],
|
88 |
+
$requestArray[Inside_Analytics_Helper_Data::REQUEST_PART_ACTION]
|
89 |
+
))
|
90 |
{
|
91 |
+
$match = $type; break;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
if ($match) {
|
95 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
|
|
97 |
}
|
98 |
}
|
99 |
return $match ? $match : Inside_Analytics_Model_System_Config_Source_Page_Type::OTHER;
|
107 |
*/
|
108 |
protected function _getPageTypeExact($key)
|
109 |
{
|
110 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
111 |
+
|
112 |
+
foreach ($this->getTypeActions() as $type => $routes)
|
113 |
{
|
114 |
+
foreach ($routes as $route) {
|
115 |
+
/* @var $route Inside_Analytics_Model_Route */
|
116 |
+
if ($route->getFullQualifier() == $key) {
|
117 |
+
return $type;
|
118 |
+
}
|
119 |
}
|
120 |
}
|
121 |
return false;
|
129 |
*/
|
130 |
public function getPageName($type)
|
131 |
{
|
132 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
133 |
+
|
134 |
$name = 'Unknown/Untracked Page Type';
|
135 |
switch ($type) {
|
136 |
case Inside_Analytics_Model_System_Config_Source_Page_Type::HOMEPAGE:
|
app/code/community/Inside/Analytics/Model/Route.php
CHANGED
@@ -40,15 +40,27 @@ class Inside_Analytics_Model_Route extends Mage_Core_Model_Abstract {
|
|
40 |
*/
|
41 |
public function matches($module, $controller, $action)
|
42 |
{
|
|
|
|
|
|
|
|
|
43 |
if ($this->getModule() !== $module) {
|
|
|
44 |
return false;
|
45 |
}
|
|
|
|
|
46 |
if ($this->getController() && $this->getController() !== $controller) {
|
|
|
47 |
return false;
|
48 |
}
|
|
|
|
|
49 |
if ($this->getAction() && $this->getAction() !== $action) {
|
|
|
50 |
return false;
|
51 |
}
|
|
|
52 |
return true;
|
53 |
}
|
54 |
|
@@ -58,6 +70,8 @@ class Inside_Analytics_Model_Route extends Mage_Core_Model_Abstract {
|
|
58 |
*/
|
59 |
protected function _fixRouteName()
|
60 |
{
|
|
|
|
|
61 |
$fullName = $this->getModule();
|
62 |
if ($this->getController()) {
|
63 |
$fullName = $fullName . '_' . $this->getController();
|
@@ -67,6 +81,7 @@ class Inside_Analytics_Model_Route extends Mage_Core_Model_Abstract {
|
|
67 |
}
|
68 |
}
|
69 |
$this->setFullQualifier($fullName);
|
|
|
70 |
return $this;
|
71 |
}
|
72 |
|
40 |
*/
|
41 |
public function matches($module, $controller, $action)
|
42 |
{
|
43 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
44 |
+
|
45 |
+
Mage::helper('inside')->log('$module: '.$module, true);
|
46 |
+
Mage::helper('inside')->log('$this->getModule(): '.$this->getModule(), true);
|
47 |
if ($this->getModule() !== $module) {
|
48 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
49 |
return false;
|
50 |
}
|
51 |
+
Mage::helper('inside')->log('$controller: '.$controller, true);
|
52 |
+
Mage::helper('inside')->log('$this->getController(): '.$this->getController(), true);
|
53 |
if ($this->getController() && $this->getController() !== $controller) {
|
54 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
55 |
return false;
|
56 |
}
|
57 |
+
Mage::helper('inside')->log('$action: '.$action, true);
|
58 |
+
Mage::helper('inside')->log('$this->getAction(): '.$this->getAction(), true);
|
59 |
if ($this->getAction() && $this->getAction() !== $action) {
|
60 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
61 |
return false;
|
62 |
}
|
63 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
64 |
return true;
|
65 |
}
|
66 |
|
70 |
*/
|
71 |
protected function _fixRouteName()
|
72 |
{
|
73 |
+
Mage::helper('inside')->log('ENTERING: '.__METHOD__, true);
|
74 |
+
|
75 |
$fullName = $this->getModule();
|
76 |
if ($this->getController()) {
|
77 |
$fullName = $fullName . '_' . $this->getController();
|
81 |
}
|
82 |
}
|
83 |
$this->setFullQualifier($fullName);
|
84 |
+
Mage::helper('inside')->log('LEAVING: '.__METHOD__, true);
|
85 |
return $this;
|
86 |
}
|
87 |
|
app/code/community/Inside/Analytics/controllers/Adminhtml/DebugController.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of class...
|
5 |
+
*
|
6 |
+
* @category Inside
|
7 |
+
* @package Inside_Analytics
|
8 |
+
* @author Inside <martin.novak@inside.tm>
|
9 |
+
*/
|
10 |
+
class Inside_Analytics_Adminhtml_DebugController
|
11 |
+
extends Mage_Adminhtml_Controller_Action
|
12 |
+
{
|
13 |
+
public function showlogAction()
|
14 |
+
{
|
15 |
+
try {
|
16 |
+
$logDir = Mage::getBaseDir('var') . DS . 'log';
|
17 |
+
$logFile = $logDir . DS . Inside_Analytics_Helper_Data::LOG_FILENAME;
|
18 |
+
|
19 |
+
if (!is_dir($logDir)) {
|
20 |
+
echo 'Log folder does not exist.';
|
21 |
+
return;
|
22 |
+
}
|
23 |
+
if (!file_exists($logFile)) {
|
24 |
+
echo 'Log file does not exist.';
|
25 |
+
return;
|
26 |
+
}
|
27 |
+
$contents = file_get_contents($logFile);
|
28 |
+
echo nl2br($contents);
|
29 |
+
} catch (Exception $ex) {
|
30 |
+
Mage::logException($ex);
|
31 |
+
echo 'Error occured when fetching Inside log file. See Magento exception log for more details.';
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
public function clearlogAction()
|
36 |
+
{
|
37 |
+
$logFile = Mage::getBaseDir('var') . DS . 'log' . DS . Inside_Analytics_Helper_Data::LOG_FILENAME;
|
38 |
+
if (file_exists($logFile)) {
|
39 |
+
try {
|
40 |
+
if(unlink($logFile)) {
|
41 |
+
$this->_getSession()->addSuccess($this->__('Log file deleted.'));
|
42 |
+
} else {
|
43 |
+
$this->_getSession()->addError($this->__('Unable to delete log file.'));
|
44 |
+
}
|
45 |
+
} catch (Exception $ex) {
|
46 |
+
Mage::logException($ex);
|
47 |
+
$this->_getSession()->addError($this->__('Error occured when trying to delete Inside log file. See Magento exception log for more details.'));
|
48 |
+
}
|
49 |
+
} else {
|
50 |
+
$this->_getSession()->addNotice($this->__('Inside log file does not exist.'));
|
51 |
+
}
|
52 |
+
$this->_redirect('adminhtml/system_config/edit/section/inside');
|
53 |
+
}
|
54 |
+
}
|
app/code/community/Inside/Analytics/etc/config.xml
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
<config>
|
12 |
<modules>
|
13 |
<Inside_Analytics>
|
14 |
-
<version>2.
|
15 |
</Inside_Analytics>
|
16 |
</modules>
|
17 |
<global>
|
11 |
<config>
|
12 |
<modules>
|
13 |
<Inside_Analytics>
|
14 |
+
<version>2.3.1</version>
|
15 |
</Inside_Analytics>
|
16 |
</modules>
|
17 |
<global>
|
app/code/community/Inside/Analytics/etc/system.xml
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
<show_in_store>1</show_in_store>
|
21 |
<groups>
|
22 |
<analytics translate="label">
|
23 |
-
<label>
|
24 |
<frontend_type>text</frontend_type>
|
25 |
<sort_order>10</sort_order>
|
26 |
<show_in_default>1</show_in_default>
|
@@ -56,34 +56,81 @@
|
|
56 |
</account>
|
57 |
</fields>
|
58 |
</analytics>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
<debug translate="label">
|
60 |
<label>Debug</label>
|
61 |
<frontend_type>text</frontend_type>
|
62 |
-
<sort_order>
|
63 |
<show_in_default>1</show_in_default>
|
64 |
<show_in_website>1</show_in_website>
|
65 |
<show_in_store>1</show_in_store>
|
66 |
<fields>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
<log translate="label">
|
68 |
<label>Enable Logging</label>
|
69 |
<frontend_type>select</frontend_type>
|
70 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
71 |
-
<sort_order>
|
72 |
<show_in_default>1</show_in_default>
|
73 |
<show_in_website>1</show_in_website>
|
74 |
<show_in_store>1</show_in_store>
|
75 |
<comment><![CDATA[Enable extension logging: /var/log/inside-analytics.log]]></comment>
|
76 |
</log>
|
77 |
-
|
78 |
-
<label>
|
79 |
<frontend_type>select</frontend_type>
|
80 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
81 |
-
<sort_order>
|
82 |
<show_in_default>1</show_in_default>
|
83 |
<show_in_website>1</show_in_website>
|
84 |
<show_in_store>1</show_in_store>
|
85 |
-
<comment><![CDATA[
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
</fields>
|
88 |
</debug>
|
89 |
</groups>
|
20 |
<show_in_store>1</show_in_store>
|
21 |
<groups>
|
22 |
<analytics translate="label">
|
23 |
+
<label>General</label>
|
24 |
<frontend_type>text</frontend_type>
|
25 |
<sort_order>10</sort_order>
|
26 |
<show_in_default>1</show_in_default>
|
56 |
</account>
|
57 |
</fields>
|
58 |
</analytics>
|
59 |
+
<options translate="label">
|
60 |
+
<label>Options</label>
|
61 |
+
<frontend_type>text</frontend_type>
|
62 |
+
<sort_order>20</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
<show_in_store>1</show_in_store>
|
66 |
+
<fields>
|
67 |
+
<category_title translate="label">
|
68 |
+
<label>Category From Title</label>
|
69 |
+
<frontend_type>select</frontend_type>
|
70 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
71 |
+
<sort_order>10</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
<comment><![CDATA[Builds category name out of page title. Enable for Amasty Improved Navigation and similar extensions.]]></comment>
|
76 |
+
</category_title>
|
77 |
+
</fields>
|
78 |
+
</options>
|
79 |
<debug translate="label">
|
80 |
<label>Debug</label>
|
81 |
<frontend_type>text</frontend_type>
|
82 |
+
<sort_order>30</sort_order>
|
83 |
<show_in_default>1</show_in_default>
|
84 |
<show_in_website>1</show_in_website>
|
85 |
<show_in_store>1</show_in_store>
|
86 |
<fields>
|
87 |
+
<show translate="label">
|
88 |
+
<label>Show Request</label>
|
89 |
+
<frontend_type>select</frontend_type>
|
90 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
91 |
+
<sort_order>10</sort_order>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<show_in_website>1</show_in_website>
|
94 |
+
<show_in_store>1</show_in_store>
|
95 |
+
<comment><![CDATA[Display current request module, controller and action name at the top of every page.]]></comment>
|
96 |
+
</show>
|
97 |
<log translate="label">
|
98 |
<label>Enable Logging</label>
|
99 |
<frontend_type>select</frontend_type>
|
100 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
101 |
+
<sort_order>20</sort_order>
|
102 |
<show_in_default>1</show_in_default>
|
103 |
<show_in_website>1</show_in_website>
|
104 |
<show_in_store>1</show_in_store>
|
105 |
<comment><![CDATA[Enable extension logging: /var/log/inside-analytics.log]]></comment>
|
106 |
</log>
|
107 |
+
<verbose translate="label">
|
108 |
+
<label>Verbose</label>
|
109 |
<frontend_type>select</frontend_type>
|
110 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
111 |
+
<sort_order>30</sort_order>
|
112 |
<show_in_default>1</show_in_default>
|
113 |
<show_in_website>1</show_in_website>
|
114 |
<show_in_store>1</show_in_store>
|
115 |
+
<comment><![CDATA[Full extension process log]]></comment>
|
116 |
+
<depends><log>1</log></depends>
|
117 |
+
</verbose>
|
118 |
+
<show_log translate="label">
|
119 |
+
<frontend_type>button</frontend_type>
|
120 |
+
<frontend_model>inside/adminhtml_system_config_form_button_showlog</frontend_model>
|
121 |
+
<sort_order>40</sort_order>
|
122 |
+
<show_in_default>1</show_in_default>
|
123 |
+
<show_in_website>1</show_in_website>
|
124 |
+
<show_in_store>1</show_in_store>
|
125 |
+
</show_log>
|
126 |
+
<clear_log translate="label">
|
127 |
+
<frontend_type>button</frontend_type>
|
128 |
+
<frontend_model>inside/adminhtml_system_config_form_button_clearlog</frontend_model>
|
129 |
+
<sort_order>50</sort_order>
|
130 |
+
<show_in_default>1</show_in_default>
|
131 |
+
<show_in_website>1</show_in_website>
|
132 |
+
<show_in_store>1</show_in_store>
|
133 |
+
</clear_log>
|
134 |
</fields>
|
135 |
</debug>
|
136 |
</groups>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Inside_Analytics</name>
|
4 |
-
<version>2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.inside.tm/servicecontract">Inside Service Contract</license>
|
7 |
<channel>community</channel>
|
@@ -30,11 +30,19 @@ when you see a customer walking to the Checkout and spending 10 minutes there, y
|
|
30 |
Call us for an online presentation:<br />
|
31 |
USA Call Hadar on 310.661.0308 9AM - 6PM PST <br />
|
32 |
AUS Call Michael on 03 8637 1534 9AM - 5PM EST </description>
|
33 |
-
<notes>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
<authors><author><name>Hadar Paz</name><user>MAG001834167</user><email>hadar.paz@inside.tm</email></author></authors>
|
35 |
-
<date>
|
36 |
-
<time>
|
37 |
-
<contents><target name="magecommunity"><dir name="Inside"><dir name="Analytics"><dir name="Block"><dir name="Adminhtml"><dir name="Route"><dir name="Edit"><file name="Form.php" hash="1d33f13c65cd268aa609904a598a4a43"/><dir name="Tab"><file name="General.php" hash="3fb90a753247c42454d942b9c7c12b6a"/></dir><file name="Tabs.php" hash="aeb4125bde86d7d07a1b263e9a776274"/></dir><file name="Edit.php" hash="b250cc9a5b7252d3c8b78fac93bee273"/><file name="Grid.php" hash="6819b33d1e77a64724d3d0d0b61fe894"/></dir><file name="Route.php" hash="1116daacd2d91c25c1b11c238482e9ae"/></dir><file name="Analytics.php" hash="
|
38 |
<compatible/>
|
39 |
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
40 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Inside_Analytics</name>
|
4 |
+
<version>2.3.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.inside.tm/servicecontract">Inside Service Contract</license>
|
7 |
<channel>community</channel>
|
30 |
Call us for an online presentation:<br />
|
31 |
USA Call Hadar on 310.661.0308 9AM - 6PM PST <br />
|
32 |
AUS Call Michael on 03 8637 1534 9AM - 5PM EST </description>
|
33 |
+
<notes>New Features
|
34 |
+
- routes can now be enabled/disabled
|
35 |
+
- support for ajax add to cart
|
36 |
+
- category name from page title option
|
37 |
+
- advanced debug
|
38 |
+

|
39 |
+
Fixed
|
40 |
+
- mapping of routes with underscores
|
41 |
+
- category name on product pages</notes>
|
42 |
<authors><author><name>Hadar Paz</name><user>MAG001834167</user><email>hadar.paz@inside.tm</email></author></authors>
|
43 |
+
<date>2014-07-30</date>
|
44 |
+
<time>03:30:23</time>
|
45 |
+
<contents><target name="magecommunity"><dir name="Inside"><dir name="Analytics"><dir name="Block"><dir name="Adminhtml"><dir name="Route"><dir name="Edit"><file name="Form.php" hash="1d33f13c65cd268aa609904a598a4a43"/><dir name="Tab"><file name="General.php" hash="3fb90a753247c42454d942b9c7c12b6a"/></dir><file name="Tabs.php" hash="aeb4125bde86d7d07a1b263e9a776274"/></dir><file name="Edit.php" hash="b250cc9a5b7252d3c8b78fac93bee273"/><file name="Grid.php" hash="6819b33d1e77a64724d3d0d0b61fe894"/></dir><file name="Route.php" hash="1116daacd2d91c25c1b11c238482e9ae"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Button"><file name="Clearlog.php" hash="2b15b253af80856c7e0f6b18229edb44"/><file name="Showlog.php" hash="3e44b43ce52b5d22806df05ef41fb59a"/></dir></dir></dir></dir></dir><file name="Analytics.php" hash="b3057b5d5062f14cbef6adf71e3bef75"/></dir><dir name="Helper"><file name="Data.php" hash="137a84c68dec3e5f52347fd0ae060610"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Route"><file name="Collection.php" hash="8aceeaea4490909d1536f953ba1e28c1"/></dir><file name="Route.php" hash="ef1d9069d996c6e2886a73941fb44c61"/></dir><file name="Observer.php" hash="ff67935a1c07e0c04cf3127a61872cf3"/><dir name="PageView"><file name="Type.php" hash="f00dd7e69894e535fbd5f3288117f16c"/></dir><file name="PageView.php" hash="18a2f57520e5e4ad83adbb1fd5325023"/><file name="Route.php" hash="5d5adf4663faa265967e5ae40264b7a1"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Abstract.php" hash="ffd23e007fa3f9fea473c9183bf58bc7"/><dir name="Page"><file name="Type.php" hash="4991eba0607d35132c16b0c7deec0ec0"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DebugController.php" hash="50754bcbce36b1edc99e15445b7f06bc"/><file name="RouteController.php" hash="333445550bd1f8eedf1fc3e7321e1b0d"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="11fbacf4dd6153fdff62b160f3a3cf17"/><file name="config.xml" hash="dc36469dcc233dee35374dfad1d01401"/><file name="system.xml" hash="f47fc8cbf0e91ef1cd2f8478a15b20ba"/></dir><dir name="sql"><dir name="inside_setup"><file name="mysql4-upgrade-1.1.2-2.0.0.php" hash="e123452c8d68d8961663fe6508ca580c"/><file name="mysql4-upgrade-2.0.0-2.1.0.php" hash="59426151530545b4efc807fe22002a18"/><file name="mysql4-upgrade-2.1.0-2.2.0.php" hash="4543cc4128ef9345923e9ac71c05621d"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="inside"><file name="analytics.xml" hash="76a3e04439048e976f23cf7330851ddd"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="inside"><file name="analytics.xml" hash="5d64993f4dec32725664d4ac1073b431"/></dir></dir><dir name="template"><dir name="inside"><file name="analytics.phtml" hash="b276904d6404e5ff773ac4523ea1b729"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Inside_Analytics.xml" hash="4a6e86a99302b7ddecadffb844c4c3a8"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="inside"><file name="route.js" hash="0067644797c73ca5be7c052fdcfaa78d"/></dir></dir></dir></dir></target></contents>
|
46 |
<compatible/>
|
47 |
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
48 |
</package>
|