Aromicon_Google_Universal_Analytics - Version 1.1.0

Version Notes

Fixing Currency
Fixing Ecommerce Tracking
Add Funnel Tracking

Download this release

Release Info

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


Code changes from version 1.0.3 to 1.1.0

app/code/community/Aromicon/Gua/Block/Gua.php CHANGED
@@ -27,14 +27,24 @@ class Aromicon_Gua_Block_Gua extends Mage_Core_Block_Template
27
 
28
  public function _isEcommerce()
29
  {
30
- Mage::log($this->getRequest()->getPathInfo());
31
  if(Mage::getStoreConfigFlag('aromicon_gua/ecommerce/enable')
32
- && $this->getRequest()->getPathInfo() == '/checkout/onepage/success/'){
33
  return true;
34
  }
35
  return false;
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
38
  public function getOrder()
39
  {
40
  $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
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')
32
+ && strpos($this->getRequest()->getPathInfo(), $successPath) !== false){
33
  return true;
34
  }
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')
42
+ && strpos($this->getRequest()->getPathInfo(), $checkoutPath) !== false){
43
+ return true;
44
+ }
45
+ return false;
46
+ }
47
+
48
  public function getOrder()
49
  {
50
  $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
app/code/community/Aromicon/Gua/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Aromicon_Gua>
5
- <version>1.0.1</version>
6
  </Aromicon_Gua>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Aromicon_Gua>
5
+ <version>1.1.0</version>
6
  </Aromicon_Gua>
7
  </modules>
8
  <global>
app/code/community/Aromicon/Gua/etc/system.xml CHANGED
@@ -90,6 +90,24 @@
90
  <show_in_website>1</show_in_website>
91
  <show_in_store>1</show_in_store>
92
  </transaction_id>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  </fields>
94
  </ecommerce>
95
  </groups>
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>
96
+ <sort_order>30</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ <comment>Please type in the relative URL of your checkout success page url. Standard is /checkout/onepage/success</comment>
101
+ </success_url>
102
+ <funnel_enable>
103
+ <label>Enable Funnel Tracking</label>
104
+ <frontend_type>select</frontend_type>
105
+ <source_model>adminhtml/system_config_source_yesno</source_model>
106
+ <sort_order>40</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
+ </funnel_enable>
111
  </fields>
112
  </ecommerce>
113
  </groups>
app/design/frontend/base/default/template/aromicon/gua/gua.phtml CHANGED
@@ -9,11 +9,24 @@
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->_isEcommerce()): ?>
13
  ga('require', 'ecommerce', 'ecommerce.js');
14
  <?php $_order = $this->getOrder();?>
15
- ga('set', 'currencyCode', '<?php echo $_order->getOrderCurrencyCode();?>');
16
- 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()?>'});
17
  <?php foreach($_order->getAllItems() as $_item): ?>
18
  <?php if($_item->getParentItem()) continue; ?>
19
  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() ?>'});
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');
17
+ this.accordion.openSection('opc-'+section);
18
+ this.reloadProgressBlock(section);
19
+ /**aromicon gua code*/
20
+ try{ga('send', 'pageview', {'page': '<?php echo $this->getCheckoutUrl() ?>/'+section,'title': section});}catch(e){
21
+ console.log(e);
22
+ }
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() ?>'});
package.xml CHANGED
@@ -1,18 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Aromicon_Google_Universal_Analytics</name>
4
- <version>1.0.3</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 missing template</notes>
 
 
12
  <authors><author><name>Stefan Richter</name><user>aromicon_de</user><email>kontakt@aromicon.com</email></author></authors>
13
- <date>2013-09-06</date>
14
- <time>11:00:05</time>
15
- <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="988cfee0ffe6b681435e11f913bdceea"/></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="e749ec6457d1aaddc9e7cb38ec61dc35"/><file name="system.xml" hash="2c8c2425e79e2d15ea1f4028220aa337"/></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="83d56071c238ea4bbc381871ce5e9c83"/></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>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
18
  </package>
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>