SOAP_ShoppingAnalytics - Version 1.2.2

Version Notes

Soap Roi Tracker

Download this release

Release Info

Developer Soap Media
Extension SOAP_ShoppingAnalytics
Version 1.2.2
Comparing to
See all releases


Code changes from version 1.1.0 to 1.2.2

app/code/local/SOAP/ShoppingAnalytics/Block/Sa.php CHANGED
@@ -120,20 +120,19 @@ class SOAP_ShoppingAnalytics_Block_Sa extends Mage_Core_Block_Template
120
  $totalValue = '';
121
  }
122
 
123
- return '<!-- Google Tracking Code -->
 
124
  <script type="text/javascript">
125
  /* <![CDATA[ */
126
- var google_conversion_id = '.$id.';
127
  var google_conversion_language = "'.$language.'";
128
  var google_conversion_format = "'.$format.'";
129
  var google_conversion_color = "'.$colour.'";
130
  var google_conversion_label = "'.$label.'";
131
  '.$totalValue.'
132
-
133
  /* ]]> */
134
  </script>
135
  <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"></script>
136
-
137
  <noscript>
138
  <img height=1 width=1 border=0
139
  src="http://www.googleadservices.com/pagead/
@@ -141,7 +140,7 @@ var google_conversion_label = "'.$label.'";
141
  &label='.$label.'&script=0">
142
  </noscript>
143
  <!-- END Google Tracking Code -->
144
- ';
145
  }
146
  }
147
  }
@@ -149,11 +148,43 @@ var google_conversion_label = "'.$label.'";
149
  protected function _addMicrosoftTrackingCode() {
150
  $domainid = Mage::getStoreConfig('shopping/mstracking/domain');
151
  $cp = Mage::getStoreConfig('shopping/mstracking/cp');
152
- return '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  <!-- Microsoft adCenter Tracking -->
154
  <SCRIPT>
155
  microsoft_adcenterconversion_domainid = '.$domainid.';
156
- microsoft_adcenterconversion_cp = '.$cp.';
157
  microsoft_adcenterconversionparams = new Array();
158
  microsoft_adcenterconversionparams[0] = "dedup=1";
159
  </SCRIPT>
@@ -161,20 +192,63 @@ var google_conversion_label = "'.$label.'";
161
  <NOSCRIPT>
162
  <IMG width=1 height=1 SRC="https://'.$domainid.'.r.msn.com/?type=1&cp=1&dedup=1"/>
163
  </NOSCRIPT>
164
- <a href="http://advertising.msn.com/MSNadCenter/LearningCenter/adtracking.asp" target="_blank">::adCenter::</a>
165
  <!-- END Microsoft adCenter Tracking -->
166
-
167
- ';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  }
169
 
170
  protected function _toHtml()
171
  {
172
  $output = '';
173
- if (!Mage::helper('shoppinganalytics')->isShoppingAnalyticsAvailable() && !Mage::helper('shoppinganalytics')->isGoogleTrackingAvailable()
174
- && !Mage::helper('shoppinganalytics')->isMicrosoftTrackingAvailable()) {
175
- return '';
176
- }
177
- elseif (Mage::helper('shoppinganalytics')->isShoppingAnalyticsAvailable())
178
  {
179
  $output .= parent::_toHtml();
180
  }
@@ -187,6 +261,11 @@ var google_conversion_label = "'.$label.'";
187
  $output .= $this->_addMicrosoftTrackingCode();
188
  }
189
 
 
 
 
 
 
190
  return $output;
191
  }
192
  }
120
  $totalValue = '';
121
  }
122
 
123
+ return '
124
+ <!-- Google Tracking Code -->
125
  <script type="text/javascript">
126
  /* <![CDATA[ */
127
+ var google_conversion_id = "'.$id.'";
128
  var google_conversion_language = "'.$language.'";
129
  var google_conversion_format = "'.$format.'";
130
  var google_conversion_color = "'.$colour.'";
131
  var google_conversion_label = "'.$label.'";
132
  '.$totalValue.'
 
133
  /* ]]> */
134
  </script>
135
  <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"></script>
 
136
  <noscript>
137
  <img height=1 width=1 border=0
138
  src="http://www.googleadservices.com/pagead/
140
  &label='.$label.'&script=0">
141
  </noscript>
142
  <!-- END Google Tracking Code -->
143
+ ';
144
  }
145
  }
146
  }
148
  protected function _addMicrosoftTrackingCode() {
149
  $domainid = Mage::getStoreConfig('shopping/mstracking/domain');
150
  $cp = Mage::getStoreConfig('shopping/mstracking/cp');
151
+
152
+ $orderIds = $this->getOrderIds();
153
+ if (empty($orderIds) || !is_array($orderIds)) {
154
+ return;
155
+ }
156
+ $collection = Mage::getResourceModel('sales/order_collection')
157
+ ->addFieldToFilter('entity_id', array('in' => $orderIds))
158
+ ;
159
+
160
+ foreach ($collection as $order)
161
+ {
162
+ $value = $order->getBaseGrandTotal();
163
+ if (!Mage::helper('shoppinganalytics')->isMicrosoftTrackingAvailable())
164
+ {
165
+ return '';
166
+ }
167
+ else {
168
+ $id = Mage::getStoreConfig('shopping/tracking/account');
169
+ $format = Mage::getStoreConfig('shopping/tracking/format');
170
+ $language = Mage::getStoreConfig('shopping/tracking/language');
171
+ $colour = Mage::getStoreConfig('shopping/tracking/colour');
172
+ $label = Mage::getStoreConfig('shopping/tracking/label');
173
+
174
+ if ($value > 0)
175
+ {
176
+ $totalValue = 'var google_conversion_value = "'.$value.'"';
177
+ }
178
+ else {
179
+ $totalValue = '';
180
+ }
181
+
182
+ return '
183
+
184
  <!-- Microsoft adCenter Tracking -->
185
  <SCRIPT>
186
  microsoft_adcenterconversion_domainid = '.$domainid.';
187
+ microsoft_adcenterconversion_cp = 5050;
188
  microsoft_adcenterconversionparams = new Array();
189
  microsoft_adcenterconversionparams[0] = "dedup=1";
190
  </SCRIPT>
192
  <NOSCRIPT>
193
  <IMG width=1 height=1 SRC="https://'.$domainid.'.r.msn.com/?type=1&cp=1&dedup=1"/>
194
  </NOSCRIPT>
195
+ <a href="http://advertising.msn.com/MSNadCenter/LearningCenter/adtracking.asp" target="_blank"></a>
196
  <!-- END Microsoft adCenter Tracking -->
197
+
198
+ ';
199
+ }
200
+ }
201
+ }
202
+
203
+ protected function _addAddShoppersTrackingCode() {
204
+ $orderIds = $this->getOrderIds();
205
+ if (empty($orderIds) || !is_array($orderIds)) {
206
+ return;
207
+ }
208
+ $collection = Mage::getResourceModel('sales/order_collection')
209
+ ->addFieldToFilter('entity_id', array('in' => $orderIds))
210
+ ;
211
+ $accountId = Mage::getStoreConfig(SOAP_ShoppingAnalytics_Helper_Data::XML_PATH_ASTRACKING_ACCOUNT);
212
+ foreach ($collection as $order)
213
+ {
214
+ $value = $order->getBaseGrandTotal();
215
+ if (!Mage::helper('shoppinganalytics')->isAddShoppersTrackingAvailable())
216
+ {
217
+ return '';
218
+ }
219
+ else {
220
+
221
+ if ($value > 0)
222
+ {
223
+ $totalValue = 'var google_conversion_value = "'.$value.'"';
224
+ }
225
+ else {
226
+ $totalValue = '';
227
+ }
228
+
229
+ return '
230
+ <!-- AddShoppers ROI Tracking -->
231
+ <script type="text/javascript">
232
+ AddShoppersConversion = {
233
+ order_id: "'.$order->getIncrementId().'",
234
+ value: "'.$value.'"
235
+ };
236
+ var js = document.createElement("script"); js.type = "text/javascript"; js.async = true; js.id = "AddShoppers";
237
+ js.src = ("https:" == document.location.protocol ? "https://shop.pe/widget/" : "http://cdn.shop.pe/widget/") + "widget_async.js#'.$accountId.'";
238
+ document.getElementsByTagName("head")[0].appendChild(js);
239
+ </script>
240
+ <!-- END AddShoppers ROI Tracking -->
241
+
242
+ ';
243
+ }
244
+ }
245
  }
246
 
247
  protected function _toHtml()
248
  {
249
  $output = '';
250
+
251
+ if (Mage::helper('shoppinganalytics')->isShoppingAnalyticsAvailable())
 
 
 
252
  {
253
  $output .= parent::_toHtml();
254
  }
261
  $output .= $this->_addMicrosoftTrackingCode();
262
  }
263
 
264
+ if ((Mage::helper('shoppinganalytics')->isAddShoppersTrackingAvailable()))
265
+ {
266
+ $output .= $this->_addAddShoppersTrackingCode();
267
+ }
268
+
269
  return $output;
270
  }
271
  }
app/code/local/SOAP/ShoppingAnalytics/Block/Saf.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * This source file is subject to the Open Software License (OSL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://opensource.org/licenses/osl-3.0.php
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@magentocommerce.com so we can send you a copy immediately.
12
+ *
13
+ * @category Mage
14
+ * @package SOAP_ShoppingAnalytics
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ /**
20
+ * ShoppingAnalytics Page Block
21
+ *
22
+ * @category Mage
23
+ * @package SOAP_ShoppingAnalytics
24
+ * @author SOAP Media
25
+ */
26
+
27
+ class SOAP_ShoppingAnalytics_Block_Saf extends Mage_Core_Block_Template
28
+ {
29
+
30
+ }
app/code/local/SOAP/ShoppingAnalytics/Helper/Data.php CHANGED
@@ -32,6 +32,9 @@ class SOAP_ShoppingAnalytics_Helper_Data extends Mage_Core_Helper_Abstract
32
 
33
  const XML_PATH_MSTRACKING_ACTIVE = 'shopping/mstracking/active';
34
  const XML_PATH_MSTRACKING_ACCOUNT = 'shopping/mstracking/domain';
 
 
 
35
 
36
  public function isShoppingAnalyticsAvailable($store = null)
37
  {
@@ -50,4 +53,10 @@ class SOAP_ShoppingAnalytics_Helper_Data extends Mage_Core_Helper_Abstract
50
  $accountId = Mage::getStoreConfig(self::XML_PATH_MSTRACKING_ACCOUNT, $store);
51
  return $accountId && Mage::getStoreConfigFlag(self::XML_PATH_MSTRACKING_ACTIVE, $store);
52
  }
 
 
 
 
 
 
53
  }
32
 
33
  const XML_PATH_MSTRACKING_ACTIVE = 'shopping/mstracking/active';
34
  const XML_PATH_MSTRACKING_ACCOUNT = 'shopping/mstracking/domain';
35
+
36
+ const XML_PATH_ASTRACKING_ACTIVE = 'shopping/astracking/active';
37
+ const XML_PATH_ASTRACKING_ACCOUNT = 'shopping/astracking/account';
38
 
39
  public function isShoppingAnalyticsAvailable($store = null)
40
  {
53
  $accountId = Mage::getStoreConfig(self::XML_PATH_MSTRACKING_ACCOUNT, $store);
54
  return $accountId && Mage::getStoreConfigFlag(self::XML_PATH_MSTRACKING_ACTIVE, $store);
55
  }
56
+
57
+ public function isAddShoppersTrackingAvailable($store = null)
58
+ {
59
+ $accountId = Mage::getStoreConfig(self::XML_PATH_ASTRACKING_ACCOUNT, $store);
60
+ return $accountId && Mage::getStoreConfigFlag(self::XML_PATH_ASTRACKING_ACTIVE, $store);
61
+ }
62
  }
app/code/local/SOAP/ShoppingAnalytics/etc/config.xml CHANGED
@@ -19,7 +19,7 @@
19
  <config>
20
  <modules>
21
  <SOAP_ShoppingAnalytics>
22
- <version>1.1</version>
23
  </SOAP_ShoppingAnalytics>
24
  </modules>
25
  <global>
19
  <config>
20
  <modules>
21
  <SOAP_ShoppingAnalytics>
22
+ <version>1.2.1</version>
23
  </SOAP_ShoppingAnalytics>
24
  </modules>
25
  <global>
app/code/local/SOAP/ShoppingAnalytics/etc/system.xml CHANGED
@@ -152,16 +152,43 @@
152
  <show_in_website>1</show_in_website>
153
  <show_in_store>1</show_in_store>
154
  </domain>
155
- <cp translate="label">
156
  <label>CP: </label>
157
  <frontend_type>text</frontend_type>
158
  <sort_order>25</sort_order>
159
  <show_in_default>1</show_in_default>
160
  <show_in_website>1</show_in_website>
161
  <show_in_store>1</show_in_store>
162
- </cp>
163
  </fields>
164
  </mstracking>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  </groups>
166
  </shopping>
167
  </sections>
152
  <show_in_website>1</show_in_website>
153
  <show_in_store>1</show_in_store>
154
  </domain>
155
+ <!-- <cp translate="label">
156
  <label>CP: </label>
157
  <frontend_type>text</frontend_type>
158
  <sort_order>25</sort_order>
159
  <show_in_default>1</show_in_default>
160
  <show_in_website>1</show_in_website>
161
  <show_in_store>1</show_in_store>
162
+ </cp> -->
163
  </fields>
164
  </mstracking>
165
+ <astracking translate="label">
166
+ <label>AddShoppers ROI Tracking</label>
167
+ <frontend_type>text</frontend_type>
168
+ <sort_order>25</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_website>1</show_in_website>
171
+ <show_in_store>1</show_in_store>
172
+ <fields>
173
+ <active translate="label">
174
+ <label>Enabled</label>
175
+ <frontend_type>select</frontend_type>
176
+ <source_model>adminhtml/system_config_source_yesno</source_model>
177
+ <sort_order>10</sort_order>
178
+ <show_in_default>1</show_in_default>
179
+ <show_in_website>1</show_in_website>
180
+ <show_in_store>1</show_in_store>
181
+ </active>
182
+ <account translate="label">
183
+ <label>Account Number</label>
184
+ <frontend_type>text</frontend_type>
185
+ <sort_order>20</sort_order>
186
+ <show_in_default>1</show_in_default>
187
+ <show_in_website>1</show_in_website>
188
+ <show_in_store>1</show_in_store>
189
+ </account>
190
+ </fields>
191
+ </astracking>
192
  </groups>
193
  </shopping>
194
  </sections>
app/design/frontend/base/default/layout/shoppinganalytics.xml CHANGED
@@ -23,5 +23,9 @@
23
  <reference name="after_body_start">
24
  <block type="shoppinganalytics/sa" name="shopping_analytics" as="shopping_analytics" template="shoppinganalytics/sa.phtml" />
25
  </reference>
 
 
 
 
26
  </default>
27
  </layout>
23
  <reference name="after_body_start">
24
  <block type="shoppinganalytics/sa" name="shopping_analytics" as="shopping_analytics" template="shoppinganalytics/sa.phtml" />
25
  </reference>
26
+
27
+ <reference name="before_body_end">
28
+ <block type="shoppinganalytics/saf" name="shopping_analytics_foot" as="shopping_analytics_foot" template="shoppinganalytics/safoot.phtml" />
29
+ </reference>
30
  </default>
31
  </layout>
app/design/frontend/base/default/template/shoppinganalytics/safoot.phtml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $accountId = Mage::getStoreConfig(SOAP_ShoppingAnalytics_Helper_Data::XML_PATH_ASTRACKING_ACCOUNT); ?>
2
+ <?php if (Mage::helper('shoppinganalytics')->isAddShoppersTrackingAvailable()) : ?>
3
+
4
+
5
+ <!-- AddShoppers Analytics Code -->
6
+ <script type="text/javascript">
7
+ AddShoppersTracking = {
8
+ image: '' // add URL for custom product image (RECOMMENDED if not using Product Schema)
9
+ };
10
+ var js = document.createElement('script'); js.type = 'text/javascript'; js.async = true; js.id = 'AddShoppers';
11
+ js.src = ('https:' == document.location.protocol ? 'https://shop.pe/widget/' : 'http://cdn.shop.pe/widget/') + 'widget_async.js#<?php echo $accountId; ?>';
12
+ document.getElementsByTagName("head")[0].appendChild(js);
13
+ </script>
14
+ <!-- END AddShoppers Analytics Code -->
15
+
16
+ <?php endif; ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>SOAP_ShoppingAnalytics</name>
4
- <version>1.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl.html">GNU General Public License</license>
7
  <channel>community</channel>
@@ -15,9 +15,9 @@ The Magento ROI Tracker enables the option to easily manage Adwords conversion t
15
  To keep up to date follow the our &lt;a href="http://www.soapmedia.co.uk/magento-roi-tracking-extension/"&gt;Mangeto ROI Tracking&lt;/a&gt; post on our blog</description>
16
  <notes>Soap Roi Tracker</notes>
17
  <authors><author><name>Soap Media</name><user>toocanx</user><email>adam@soapmedia.co.uk</email></author></authors>
18
- <date>2012-10-29</date>
19
- <time>14:09:42</time>
20
- <contents><target name="magelocal"><dir><dir name="SOAP"><dir><dir name="ShoppingAnalytics"><dir name="Block"><file name="Hint.php" hash="072d7b20b293ac5bc8352221c095820b"/><file name="Sa.php" hash="489b4ac8b0092519f181bcc62bd08eb8"/></dir><dir name="Helper"><file name="Data.php" hash="625b11a774060b1189dfde4f6385add7"/></dir><dir name="Model"><file name="Observer.php" hash="bcb871edd134be8e1ed0a37cfbae96a9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="da2d3619541c4df47c925d3921a62847"/><file name="config.xml" hash="b5897332867f8aa7c104996760c47bc1"/><file name="system.xml" hash="8d959c2c15b607ccced8cc9cc51d9819"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="shoppinganalytics"><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="685eedf009fc1494fd266ca93a27923a"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="shoppinganalytics.xml" hash="287589c95687eb245f78ab95b6492093"/></dir><dir name="template"><dir name="shoppinganalytics"><file name="sa.phtml" hash="56d272a9fc9e71038f7455aae1a126f4"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="SOAP_ShoppingAnalyics.xml" hash="356026928a86b699d9a6ff759b43f617"/></dir></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>SOAP_ShoppingAnalytics</name>
4
+ <version>1.2.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl.html">GNU General Public License</license>
7
  <channel>community</channel>
15
  To keep up to date follow the our &lt;a href="http://www.soapmedia.co.uk/magento-roi-tracking-extension/"&gt;Mangeto ROI Tracking&lt;/a&gt; post on our blog</description>
16
  <notes>Soap Roi Tracker</notes>
17
  <authors><author><name>Soap Media</name><user>toocanx</user><email>adam@soapmedia.co.uk</email></author></authors>
18
+ <date>2012-10-30</date>
19
+ <time>10:34:22</time>
20
+ <contents><target name="magelocal"><dir><dir name="SOAP"><dir><dir name="ShoppingAnalytics"><dir name="Block"><file name="Hint.php" hash="072d7b20b293ac5bc8352221c095820b"/><file name="Sa.php" hash="513840d39d79cd6ff30b74daf582dd12"/><file name="Saf.php" hash="7b974312f1a45026dd16fd1da093b078"/></dir><dir name="Helper"><file name="Data.php" hash="60959b60dbe1af7f34c6cc6d84e5c41a"/></dir><dir name="Model"><file name="Observer.php" hash="bcb871edd134be8e1ed0a37cfbae96a9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="da2d3619541c4df47c925d3921a62847"/><file name="config.xml" hash="b1e7e8b729dd5b0dbc6ea31d6c1359ab"/><file name="system.xml" hash="683c408e80dce495e86657df0a7079d3"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="shoppinganalytics"><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="685eedf009fc1494fd266ca93a27923a"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="shoppinganalytics.xml" hash="d19a4a1d9cb71e395f0c7a3351df02bf"/></dir><dir name="template"><dir name="shoppinganalytics"><file name="sa.phtml" hash="56d272a9fc9e71038f7455aae1a126f4"/><file name="safoot.phtml" hash="cddb49ace8439e161d5b68d9893a1ce1"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="SOAP_ShoppingAnalyics.xml" hash="356026928a86b699d9a6ff759b43f617"/></dir></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>