Aromicon_Google_Universal_Analytics - Version 1.2.0

Version Notes

Fixing JS Error on Success Page
Adding Custom Dimension and Metrics for Products
Adding Custom Dimension and Metrics for Customers
Adding Remarketing (displayfeatures)

Download this release

Release Info

Developer Stefan Richter
Extension Aromicon_Google_Universal_Analytics
Version 1.2.0
Comparing to
See all releases


Code changes from version 1.1.0 to 1.2.0

app/code/community/Aromicon/Gua/Block/Gua.php CHANGED
@@ -1,17 +1,14 @@
1
  <?php
2
- /**
3
- * @package
4
- * @author Stefan richter (richter@aromicon.com)
5
- * @license aromicon gmbh 2013
6
- */
7
  class Aromicon_Gua_Block_Gua extends Mage_Core_Block_Template
8
  {
9
- protected function _getAccountId()
 
 
10
  {
11
  return Mage::getStoreConfig('aromicon_gua/general/account_id');
12
  }
13
 
14
- protected function _isAnonymizeIp()
15
  {
16
  return Mage::getStoreConfigFlag('aromicon_gua/general/anonymize_ip') ? 'true' : 'false';
17
  }
@@ -25,7 +22,7 @@ class Aromicon_Gua_Block_Gua extends Mage_Core_Block_Template
25
  return false;
26
  }
27
 
28
- public function _isEcommerce()
29
  {
30
  $successPath = Mage::getStoreConfig('aromicon_gua/ecommerce/success_url') != "" ? Mage::getStoreConfig('aromicon_gua/ecommerce/success_url') : '/checkout/onepage/success';
31
  if(Mage::getStoreConfigFlag('aromicon_gua/ecommerce/enable')
@@ -35,7 +32,7 @@ class Aromicon_Gua_Block_Gua extends Mage_Core_Block_Template
35
  return false;
36
  }
37
 
38
- public function _isCheckout()
39
  {
40
  $checkoutPath = Mage::getStoreConfig('aromicon_gua/ecommerce/checkout_url') != "" ? Mage::getStoreConfig('aromicon_gua/ecommerce/checkout_url') : '/checkout/onepage';
41
  if(Mage::getStoreConfigFlag('aromicon_gua/ecommerce/funnel_enable')
@@ -45,10 +42,31 @@ class Aromicon_Gua_Block_Gua extends Mage_Core_Block_Template
45
  return false;
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  public function getOrder()
49
  {
50
- $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
51
- return Mage::getModel('sales/order')->load($orderId);
 
 
 
52
  }
53
 
54
  public function getTransactionIdField()
@@ -56,7 +74,79 @@ class Aromicon_Gua_Block_Gua extends Mage_Core_Block_Template
56
  return Mage::getStoreConfig('aromicon_gua/ecommerce/transaction_id') != false ? Mage::getStoreConfig('aromicon_gua/ecommerce/transaction_id') : 'entity_id';
57
  }
58
 
 
 
 
 
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
 
 
 
 
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
1
  <?php
 
 
 
 
 
2
  class Aromicon_Gua_Block_Gua extends Mage_Core_Block_Template
3
  {
4
+ public $_order;
5
+
6
+ public function getAccountId()
7
  {
8
  return Mage::getStoreConfig('aromicon_gua/general/account_id');
9
  }
10
 
11
+ public function isAnonymizeIp()
12
  {
13
  return Mage::getStoreConfigFlag('aromicon_gua/general/anonymize_ip') ? 'true' : 'false';
14
  }
22
  return false;
23
  }
24
 
25
+ public function isEcommerce()
26
  {
27
  $successPath = Mage::getStoreConfig('aromicon_gua/ecommerce/success_url') != "" ? Mage::getStoreConfig('aromicon_gua/ecommerce/success_url') : '/checkout/onepage/success';
28
  if(Mage::getStoreConfigFlag('aromicon_gua/ecommerce/enable')
32
  return false;
33
  }
34
 
35
+ public function isCheckout()
36
  {
37
  $checkoutPath = Mage::getStoreConfig('aromicon_gua/ecommerce/checkout_url') != "" ? Mage::getStoreConfig('aromicon_gua/ecommerce/checkout_url') : '/checkout/onepage';
38
  if(Mage::getStoreConfigFlag('aromicon_gua/ecommerce/funnel_enable')
42
  return false;
43
  }
44
 
45
+ public function getCheckoutUrl()
46
+ {
47
+ return Mage::getStoreConfig('aromicon_gua/ecommerce/checkout_url') != "" ? Mage::getStoreConfig('aromicon_gua/ecommerce/checkout_url') : '/checkout/onepage';
48
+ }
49
+
50
+ public function getActiveStep()
51
+ {
52
+ return Mage::getSingleton('customer/session')->isLoggedIn() ? 'billing' : 'login';
53
+ }
54
+
55
+ public function isSSL()
56
+ {
57
+ return Mage::getStoreConfigFlag('aromicon_gua/general/force_ssl');
58
+ }
59
+
60
+ /**
61
+ * @return Mage_Sales_Model_Order
62
+ */
63
  public function getOrder()
64
  {
65
+ if(!isset($this->_order)){
66
+ $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
67
+ $this->_order = Mage::getModel('sales/order')->load($orderId);
68
+ }
69
+ return $this->_order;
70
  }
71
 
72
  public function getTransactionIdField()
74
  return Mage::getStoreConfig('aromicon_gua/ecommerce/transaction_id') != false ? Mage::getStoreConfig('aromicon_gua/ecommerce/transaction_id') : 'entity_id';
75
  }
76
 
77
+ public function isCustomerGroup()
78
+ {
79
+ return Mage::getStoreConfigFlag('aromicon_gua/customer/enable_customergroup') && $this->getCustomerGroupDimensionId() != '';
80
+ }
81
 
82
+ public function getCustomerGroupDimensionId()
83
+ {
84
+ return Mage::getStoreConfig('aromicon_gua/customer/dimension_customergroup');
85
+ }
86
+
87
+ public function getCustomerGroup()
88
+ {
89
+ $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
90
+ return Mage::getModel('customer/group')->load($groupId)->getCode();
91
+ }
92
+
93
+ public function isFirstPurchase()
94
+ {
95
+ return Mage::getStoreConfigFlag('aromicon_gua/customer/enable_first_order') && $this->getFirstPurchaseDimensionId() !='';
96
+ }
97
 
98
+ public function getFirstPurchaseDimensionId()
99
+ {
100
+ return Mage::getStoreConfig('aromicon_gua/customer/dimension_first_purchase');
101
+ }
102
 
103
+ public function isNumberOfPurchase()
104
+ {
105
+ return Mage::getStoreConfigFlag('aromicon_gua/customer/enable_customer_orders') && $this->getNumberOfPurchaseMetricId() !='';
106
+ }
107
+
108
+ public function getNumberOfPurchaseMetricId()
109
+ {
110
+ return Mage::getStoreConfig('aromicon_gua/customer/metric_customer_orders');
111
+ }
112
+
113
+ public function getNumberOfOrders()
114
+ {
115
+ return Mage::getResourceModel('sale/order_collection')
116
+ ->addFieldToFilter('customer_email', array('eq' => $this->getOrder()->getCustomerEmail()))
117
+ ->getSize();
118
+ }
119
+
120
+ public function isRemarketing()
121
+ {
122
+ return Mage::getStoreConfigFlag('aromicon_gua/remarketing/enable');
123
+ }
124
+
125
+ public function isPriceTracking()
126
+ {
127
+ return Mage::getStoreConfigFlag('aromicon_gua/product/enable_price') && $this->getPriceMetricId() !='';
128
+ }
129
+
130
+ public function getPriceMetricId()
131
+ {
132
+ return Mage::getStoreConfig('aromicon_gua/product/metric_price');
133
+ }
134
+
135
+ public function isAvailabilityTracking()
136
+ {
137
+ return Mage::getStoreConfigFlag('aromicon_gua/product/enable_availability') && Mage::getStoreConfig('aromicon_gua/product/dimension_availability') != '';
138
+ }
139
+
140
+ public function getAvailabilityDimensionId()
141
+ {
142
+ return Mage::getStoreConfig('aromicon_gua/product/dimension_availability');
143
+ }
144
+
145
+ /**
146
+ * @return Mage_Catalog_Model_Product
147
+ */
148
+ public function getProduct()
149
+ {
150
+ return Mage::registry('current_product');
151
+ }
152
  }
app/code/community/Aromicon/Gua/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Aromicon_Gua>
5
- <version>1.1.0</version>
6
  </Aromicon_Gua>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Aromicon_Gua>
5
+ <version>1.2.0</version>
6
  </Aromicon_Gua>
7
  </modules>
8
  <global>
app/code/community/Aromicon/Gua/etc/system.xml CHANGED
@@ -41,7 +41,7 @@
41
  <show_in_default>1</show_in_default>
42
  <show_in_website>1</show_in_website>
43
  <show_in_store>1</show_in_store>
44
- <comment></comment>
45
  </add_to>
46
  <account_id>
47
  <label>Account Id</label>
@@ -50,27 +50,37 @@
50
  <show_in_default>1</show_in_default>
51
  <show_in_website>1</show_in_website>
52
  <show_in_store>1</show_in_store>
53
- <comment></comment>
54
  </account_id>
55
  <anonymize_ip>
56
  <label>Anonymize Ip</label>
57
  <frontend_type>select</frontend_type>
58
  <source_model>adminhtml/system_config_source_yesno</source_model>
59
- <sort_order>10</sort_order>
60
  <show_in_default>1</show_in_default>
61
  <show_in_website>1</show_in_website>
62
  <show_in_store>1</show_in_store>
63
  </anonymize_ip>
 
 
 
 
 
 
 
 
 
 
64
  </fields>
65
  </general>
66
  <ecommerce translate="label" module="aromicon_gua">
67
- <label>e-Commerce</label>
68
  <frontend_type>text</frontend_type>
69
  <sort_order>20</sort_order>
70
  <show_in_default>1</show_in_default>
71
  <show_in_website>1</show_in_website>
72
  <show_in_store>1</show_in_store>
73
- <comment>Here you can enable e-Commerce Tracking for Google Universal Analytics. Tracking Code is added to Success Page.</comment>
74
  <fields>
75
  <enable>
76
  <label>Enable</label>
@@ -90,6 +100,15 @@
90
  <show_in_website>1</show_in_website>
91
  <show_in_store>1</show_in_store>
92
  </transaction_id>
 
 
 
 
 
 
 
 
 
93
  <success_url>
94
  <label>Checkout Success Page URL</label>
95
  <frontend_type>text</frontend_type>
@@ -110,6 +129,165 @@
110
  </funnel_enable>
111
  </fields>
112
  </ecommerce>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  </groups>
114
  </aromicon_gua>
115
  </sections>
41
  <show_in_default>1</show_in_default>
42
  <show_in_website>1</show_in_website>
43
  <show_in_store>1</show_in_store>
44
+ <comment>Here you can choose the script postion in you html code. "Head" will work always. "Before Body End" might not work on custom themes.</comment>
45
  </add_to>
46
  <account_id>
47
  <label>Account Id</label>
50
  <show_in_default>1</show_in_default>
51
  <show_in_website>1</show_in_website>
52
  <show_in_store>1</show_in_store>
53
+ <comment>Please enter your UA Id here. e.g. UA-4xxxxxxx-1</comment>
54
  </account_id>
55
  <anonymize_ip>
56
  <label>Anonymize Ip</label>
57
  <frontend_type>select</frontend_type>
58
  <source_model>adminhtml/system_config_source_yesno</source_model>
59
+ <sort_order>40</sort_order>
60
  <show_in_default>1</show_in_default>
61
  <show_in_website>1</show_in_website>
62
  <show_in_store>1</show_in_store>
63
  </anonymize_ip>
64
+ <force_ssl>
65
+ <label>Force SSL</label>
66
+ <frontend_type>select</frontend_type>
67
+ <source_model>adminhtml/system_config_source_yesno</source_model>
68
+ <comment>Force SSL, set to 'Yes' if you want always to send data over https.</comment>
69
+ <sort_order>50</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>1</show_in_website>
72
+ <show_in_store>1</show_in_store>
73
+ </force_ssl>
74
  </fields>
75
  </general>
76
  <ecommerce translate="label" module="aromicon_gua">
77
+ <label>E-Commerce</label>
78
  <frontend_type>text</frontend_type>
79
  <sort_order>20</sort_order>
80
  <show_in_default>1</show_in_default>
81
  <show_in_website>1</show_in_website>
82
  <show_in_store>1</show_in_store>
83
+ <comment>Here you can enable E-Commerce Tracking for Google Universal Analytics. Tracking Code is added to Success Page.</comment>
84
  <fields>
85
  <enable>
86
  <label>Enable</label>
100
  <show_in_website>1</show_in_website>
101
  <show_in_store>1</show_in_store>
102
  </transaction_id>
103
+ <checkout_url>
104
+ <label>Checkout URL</label>
105
+ <frontend_type>text</frontend_type>
106
+ <sort_order>25</sort_order>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>1</show_in_website>
109
+ <show_in_store>1</show_in_store>
110
+ <comment>Please type in the relative URL of your checkout url without trailing slash. Standard is /checkout/onepage</comment>
111
+ </checkout_url>
112
  <success_url>
113
  <label>Checkout Success Page URL</label>
114
  <frontend_type>text</frontend_type>
129
  </funnel_enable>
130
  </fields>
131
  </ecommerce>
132
+ <customer translate="label" module="aromicon_gua">
133
+ <label>Customer</label>
134
+ <frontend_type>text</frontend_type>
135
+ <sort_order>30</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>1</show_in_website>
138
+ <show_in_store>1</show_in_store>
139
+ <comment>Here you can enable some Custom Dimensions and Custom Metrics for Customer Tracking. You always have to setup those dimensions and metrics first.
140
+ Please refer to Google Universial Analytics Manual, how to setup Custom Dimensions.</comment>
141
+ <fields>
142
+ <enable_customergroup>
143
+ <label>Enable Customer Group Tracking</label>
144
+ <frontend_type>select</frontend_type>
145
+ <source_model>adminhtml/system_config_source_yesno</source_model>
146
+ <sort_order>10</sort_order>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>1</show_in_store>
150
+ <comment>Activate Customer Group Tracking. Setup custom dimension first and copy dimension id.</comment>
151
+ </enable_customergroup>
152
+ <dimension_customergroup>
153
+ <label>Customer Group Dimension</label>
154
+ <frontend_type>text</frontend_type>
155
+ <sort_order>20</sort_order>
156
+ <show_in_default>1</show_in_default>
157
+ <show_in_website>1</show_in_website>
158
+ <show_in_store>1</show_in_store>
159
+ <comment>Please add your Dimension Id here.(e.g. 1)</comment>
160
+ <depends>
161
+ <enable_customergroup>1</enable_customergroup>
162
+ </depends>
163
+ </dimension_customergroup>
164
+ <!--enable_first_order>
165
+ <label>Enable Customer First Purchase Tracking ( Date )</label>
166
+ <frontend_type>select</frontend_type>
167
+ <source_model>adminhtml/system_config_source_yesno</source_model>
168
+ <sort_order>30</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
+ <comment>Activate First Purchase Date Tracking. Setup custom dimension first and copy dimension id.</comment>
173
+ </enable_first_order>
174
+ <dimension_first_order>
175
+ <label>First Purchase Date Dimension</label>
176
+ <frontend_type>text</frontend_type>
177
+ <validate>validate-number</validate>
178
+ <sort_order>40</sort_order>
179
+ <show_in_default>1</show_in_default>
180
+ <show_in_website>1</show_in_website>
181
+ <show_in_store>1</show_in_store>
182
+ <comment>Please add your Dimension Id here.(e.g. 1)</comment>
183
+ <depends>
184
+ <enable_first_order>1</enable_first_order>
185
+ </depends>
186
+ </dimension_first_order>
187
+ <enable_customer_orders>
188
+ <label>Enable Customers Number of Purchases Tracking ( Count )</label>
189
+ <frontend_type>select</frontend_type>
190
+ <source_model>adminhtml/system_config_source_yesno</source_model>
191
+ <sort_order>50</sort_order>
192
+ <show_in_default>1</show_in_default>
193
+ <show_in_website>1</show_in_website>
194
+ <show_in_store>1</show_in_store>
195
+ <comment>Activate Number of Purchases Tracking. Setup custom dimension first and copy dimension id.</comment>
196
+ </enable_customer_orders>
197
+ <metric_customer_orders>
198
+ <label>Number Of Purchases Metric</label>
199
+ <frontend_type>text</frontend_type>
200
+ <validate>validate-number</validate>
201
+ <sort_order>60</sort_order>
202
+ <show_in_default>1</show_in_default>
203
+ <show_in_website>1</show_in_website>
204
+ <show_in_store>1</show_in_store>
205
+ <comment>Please add your Metric Id here.(e.g. 1)</comment>
206
+ <depends>
207
+ <enable_customer_orders>1</enable_customer_orders>
208
+ </depends>
209
+ </metric_customer_orders-->
210
+ </fields>
211
+ </customer>
212
+ <product translate="label" module="aromicon_gua">
213
+ <label>Product View</label>
214
+ <frontend_type>text</frontend_type>
215
+ <sort_order>40</sort_order>
216
+ <show_in_default>1</show_in_default>
217
+ <show_in_website>1</show_in_website>
218
+ <show_in_store>1</show_in_store>
219
+ <comment><![CDATA[Here you can enable some Custom Dimensions and Custom Metrics for Product Pageview Tracking. You always have to setup those dimensions and metrics first.
220
+ Please refer to <a href="https://developers.google.com/analytics/devguides/platform/customdimsmets">Google Universial Analytics Manual</a>, how to setup Custom Dimensions.]]></comment>
221
+ <fields>
222
+ <enable_price>
223
+ <label>Enable Product Price Tracking</label>
224
+ <frontend_type>select</frontend_type>
225
+ <source_model>adminhtml/system_config_source_yesno</source_model>
226
+ <sort_order>10</sort_order>
227
+ <show_in_default>1</show_in_default>
228
+ <show_in_website>1</show_in_website>
229
+ <show_in_store>1</show_in_store>
230
+ <comment>Activate First Purchase Date Tracking. Setup custom dimension first and copy dimension id.</comment>
231
+ </enable_price>
232
+ <metric_price>
233
+ <label>Product Price Metric</label>
234
+ <frontend_type>text</frontend_type>
235
+ <validate>validate-number</validate>
236
+ <sort_order>20</sort_order>
237
+ <show_in_default>1</show_in_default>
238
+ <show_in_website>1</show_in_website>
239
+ <show_in_store>1</show_in_store>
240
+ <comment>Please add your Metrics Id here.(e.g. 1), You have to setup this metric as currency.</comment>
241
+ <depends>
242
+ <enable_price>1</enable_price>
243
+ </depends>
244
+ </metric_price>
245
+ <enable_availability>
246
+ <label>Enable Product Availablity Tracking</label>
247
+ <frontend_type>select</frontend_type>
248
+ <source_model>adminhtml/system_config_source_yesno</source_model>
249
+ <sort_order>30</sort_order>
250
+ <show_in_default>1</show_in_default>
251
+ <show_in_website>1</show_in_website>
252
+ <show_in_store>1</show_in_store>
253
+ <comment>Activate First Purchase Date Tracking. Setup custom dimension first and copy dimension id.</comment>
254
+ </enable_availability>
255
+ <dimension_availability>
256
+ <label>Product Availabilty Dimension</label>
257
+ <frontend_type>text</frontend_type>
258
+ <validate>validate-number</validate>
259
+ <sort_order>40</sort_order>
260
+ <show_in_default>1</show_in_default>
261
+ <show_in_website>1</show_in_website>
262
+ <show_in_store>1</show_in_store>
263
+ <comment>Please add your Dimension Id here.(e.g. 1)</comment>
264
+ <depends>
265
+ <enable_availability>1</enable_availability>
266
+ </depends>
267
+ </dimension_availability>
268
+ </fields>
269
+ </product>
270
+ <remarketing translate="label" module="aromicon_gua">
271
+ <label>Remarketing</label>
272
+ <frontend_type>text</frontend_type>
273
+ <sort_order>50</sort_order>
274
+ <show_in_default>1</show_in_default>
275
+ <show_in_website>1</show_in_website>
276
+ <show_in_store>1</show_in_store>
277
+ <comment></comment>
278
+ <fields>
279
+ <enable>
280
+ <label>Enable Remarketing</label>
281
+ <frontend_type>select</frontend_type>
282
+ <source_model>adminhtml/system_config_source_yesno</source_model>
283
+ <sort_order>10</sort_order>
284
+ <show_in_default>1</show_in_default>
285
+ <show_in_website>1</show_in_website>
286
+ <show_in_store>1</show_in_store>
287
+ <comment></comment>
288
+ </enable>
289
+ </fields>
290
+ </remarketing>
291
  </groups>
292
  </aromicon_gua>
293
  </sections>
app/design/frontend/base/default/template/aromicon/gua/gua.phtml CHANGED
@@ -1,16 +1,42 @@
1
  <?php /** */?>
2
  <?php if($this->isActive()): ?>
 
3
  <script type="text/javascript">
4
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
5
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
6
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
7
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
8
 
9
- ga('create', '<?php echo $this->_getAccountId(); ?>', '<?php echo $this->getRequest()->getHttpHost() ?>');
10
- ga('set', 'anonymizeIp', <?php echo $this->_isAnonymizeIp()?>);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  ga('send', 'pageview');
12
- <?php if($this->_isCheckout()): ?>
13
  Event.observe(window, 'load', function() {
 
 
14
  Checkout.prototype.gotoSection = function(section){
15
  var sectionElement = $('opc-'+section);
16
  sectionElement.addClassName('allow');
@@ -23,11 +49,11 @@
23
  };
24
  });
25
  <?php endif;?>
26
- <?php if($this->_isEcommerce()): ?>
27
  ga('require', 'ecommerce', 'ecommerce.js');
28
  <?php $_order = $this->getOrder();?>
29
  ga('ecommerce:addTransaction', { 'id': '<?php echo $_order->getData($this->getTransactionIdField())?>', 'affiliation': '<?php echo Mage::app()->getStore()->getName() ?>', 'revenue': '<?php echo $_order->getGrandTotal()?>', 'shipping': '<?php echo $_order->getShippingInclTax()?>', 'tax': '<?php echo $_order->getTaxAmount()?>', 'currency': '<?php echo $_order->getOrderCurrencyCode();?>'});
30
- <?php foreach($_order->getAllItems() as $_item): ?>
31
  <?php if($_item->getParentItem()) continue; ?>
32
  ga('ecommerce:addItem', {'id': '<?php echo $_order->getData($this->getTransactionIdField()) ?>', 'name': '<?php echo str_replace('\'','', $_item->getName()) ?>', 'sku': '<?php echo $_item->getSku() ?>', 'price': '<?php echo $_item->getPrice() ?>', 'quantity': '<?php echo (int) $_item->getQtyOrdered() ?>'});
33
  <?php endforeach;?>
@@ -35,4 +61,5 @@
35
  <?php endif;?>
36
  </script>
37
  <?php echo $this->getChildHtml(); ?>
 
38
  <?php endif; ?>
1
  <?php /** */?>
2
  <?php if($this->isActive()): ?>
3
+ <!--Aromicon Google Universal Analytics Section start -->
4
  <script type="text/javascript">
5
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
6
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
7
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
8
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
9
 
10
+ ga('create', '<?php echo $this->getAccountId(); ?>', '<?php echo $this->getRequest()->getHttpHost() ?>');
11
+ ga('set', 'anonymizeIp', <?php echo $this->isAnonymizeIp()?>);
12
+ <?php if($this->isRemarketing()):?>
13
+ ga('require', 'displayfeatures');
14
+ <?php endif;?>
15
+ <?php if($this->isSSL()):?>
16
+ ga('set', 'forceSSL', true);
17
+ <?php endif; ?>
18
+ <?php if($this->isCustomerGroup()):?>
19
+ ga('set', 'dimension<?php echo $this->getCustomerGroupDimensionId() ?>', '<?php echo $this->getCustomerGroup()?>');
20
+ <?php endif; ?>
21
+ <?php if($this->isFirstPurchase() && $this->isEcommerce()): ?>
22
+ ga('set', 'dimension<?php echo $this->getFirstPurchaseDimensionId() ?>', '<?php echo $this->getOrder()->getCreatedAtDate()?>');
23
+ <?php endif;?>
24
+ <?php if($this->isNumberOfPurchase() && $this->isEcommerce()): ?>
25
+ ga('set', 'metric<?php echo $this->getNumberOfPurchaseMetricId() ?>', '<?php echo $this->getNumberOfOrders()?>');
26
+ <?php endif;?>
27
+ <?php if($this->getProduct()): ?>
28
+ <?php if($this->isPriceTracking()): ?>
29
+ ga('set', 'metric<?php echo $this->getPriceMetricId() ?>', '<?php echo $this->getProduct()->getFinalPrice() ?>');
30
+ <?php endif; ?>
31
+ <?php if($this->isAvailabilityTracking()): ?>
32
+ ga('set', 'dimension<?php echo $this->getAvailabilityDimensionId() ?>', '<?php echo $this->getProduct()->isSaleable() ? 'Available' : 'Not Available' ?>');
33
+ <?php endif; ?>
34
+ <?php endif;?>
35
  ga('send', 'pageview');
36
+ <?php if($this->isCheckout() && !$this->isEcommerce() ): ?>
37
  Event.observe(window, 'load', function() {
38
+ try{ga('send', 'pageview', {'page': '<?php echo $this->getCheckoutUrl() ?>/<?php echo $this->getActiveStep()?>','title': '<?php echo $this->getActiveStep()?>'});}
39
+ catch(e){console.log(e);}
40
  Checkout.prototype.gotoSection = function(section){
41
  var sectionElement = $('opc-'+section);
42
  sectionElement.addClassName('allow');
49
  };
50
  });
51
  <?php endif;?>
52
+ <?php if($this->isEcommerce()): ?>
53
  ga('require', 'ecommerce', 'ecommerce.js');
54
  <?php $_order = $this->getOrder();?>
55
  ga('ecommerce:addTransaction', { 'id': '<?php echo $_order->getData($this->getTransactionIdField())?>', 'affiliation': '<?php echo Mage::app()->getStore()->getName() ?>', 'revenue': '<?php echo $_order->getGrandTotal()?>', 'shipping': '<?php echo $_order->getShippingInclTax()?>', 'tax': '<?php echo $_order->getTaxAmount()?>', 'currency': '<?php echo $_order->getOrderCurrencyCode();?>'});
56
+ <?php foreach($_order->getAllVisibleItems() as $_item): ?>
57
  <?php if($_item->getParentItem()) continue; ?>
58
  ga('ecommerce:addItem', {'id': '<?php echo $_order->getData($this->getTransactionIdField()) ?>', 'name': '<?php echo str_replace('\'','', $_item->getName()) ?>', 'sku': '<?php echo $_item->getSku() ?>', 'price': '<?php echo $_item->getPrice() ?>', 'quantity': '<?php echo (int) $_item->getQtyOrdered() ?>'});
59
  <?php endforeach;?>
61
  <?php endif;?>
62
  </script>
63
  <?php echo $this->getChildHtml(); ?>
64
+ <!--Aromicon Google Universal Analytics Section end -->
65
  <?php endif; ?>
package.xml CHANGED
@@ -1,20 +1,22 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Aromicon_Google_Universal_Analytics</name>
4
- <version>1.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.aromicon.de/magento-download-extensions-modules/de/license">COMMERCIAL SOFTWARE LICENSE (v1.0)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Adds new Google Universal Analytics to Magento Store.</summary>
10
  <description>Adds new Google Universal Analytics to Magento Store.</description>
11
- <notes>Fixing Currency&#xD;
12
- Fixing Ecommerce Tracking&#xD;
13
- Add Funnel Tracking</notes>
 
 
14
  <authors><author><name>Stefan Richter</name><user>aromicon_de</user><email>kontakt@aromicon.com</email></author></authors>
15
- <date>2014-04-25</date>
16
- <time>17:20:40</time>
17
- <contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Aromicon"><dir name="Gua"><dir><dir name="Block"><file name="Gua.php" hash="b998de78df79939bad3817b7c1ba5d5e"/></dir><dir name="Helper"><file name="Data.php" hash="892999bec44a25b0e58c9e00373c0d7d"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Addto.php" hash="14d18fae25ecee83c1a5e872c33db83b"/><file name="Orderid.php" hash="90fcb94f06e986d19cc0c050f655d0c0"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="f7650ea1c92390b5e70b41429f7824b8"/><file name="system.xml" hash="a19b90cc2d8fffa161057fc146c58c88"/></dir><dir name="sql"><dir name="aromicon_gua_setup"><file name="mysql4-install-1.0.0.php" hash="4bbce7f9d21a131d0aefc73156c87e36"/></dir></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="aromicon"><dir name="gua"><file name="gua.phtml" hash="8b267a30c6ce15d5420b855abc1580aa"/></dir></dir></dir><dir name="layout"><file name="aromicon_gua.xml" hash="884de73b75c9e8ff9144dbf7b936225e"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Aromicon_Gua.xml" hash="cbaa405a82a74fe32c6821e3342a3b7d"/></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Aromicon_Google_Universal_Analytics</name>
4
+ <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.aromicon.de/magento-download-extensions-modules/de/license">COMMERCIAL SOFTWARE LICENSE (v1.0)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Adds new Google Universal Analytics to Magento Store.</summary>
10
  <description>Adds new Google Universal Analytics to Magento Store.</description>
11
+ <notes>Fixing JS Error on Success Page&#xD;
12
+ Adding Custom Dimension and Metrics for Products&#xD;
13
+ Adding Custom Dimension and Metrics for Customers&#xD;
14
+ Adding Remarketing (displayfeatures)&#xD;
15
+ </notes>
16
  <authors><author><name>Stefan Richter</name><user>aromicon_de</user><email>kontakt@aromicon.com</email></author></authors>
17
+ <date>2014-05-22</date>
18
+ <time>19:03:19</time>
19
+ <contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Aromicon"><dir name="Gua"><dir><dir name="Block"><file name="Gua.php" hash="3dcc6bf9d713d6ffe79940437bee931b"/></dir><dir name="Helper"><file name="Data.php" hash="892999bec44a25b0e58c9e00373c0d7d"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Addto.php" hash="14d18fae25ecee83c1a5e872c33db83b"/><file name="Orderid.php" hash="90fcb94f06e986d19cc0c050f655d0c0"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="5c3f06a3a15ed905af4311030d0a2bf2"/><file name="system.xml" hash="3287f976e3ffa81fb7b155f8edee44aa"/></dir><dir name="sql"><dir name="aromicon_gua_setup"><file name="mysql4-install-1.0.0.php" hash="4bbce7f9d21a131d0aefc73156c87e36"/></dir></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="aromicon"><dir name="gua"><file name="gua.phtml" hash="5fe76b89d678e812f63baa118cfffa6a"/></dir></dir></dir><dir name="layout"><file name="aromicon_gua.xml" hash="884de73b75c9e8ff9144dbf7b936225e"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Aromicon_Gua.xml" hash="cbaa405a82a74fe32c6821e3342a3b7d"/></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
22
  </package>