Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
0.16.9 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
fooman committed Jan 20, 2016
1 parent d074179 commit 1d3c15c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getTagManagerSnippet()
{
return Mage::getStoreConfig('google/analyticsplus_tagmanager/snippet');
}


/**
* get order from the last quote id
Expand All @@ -52,14 +52,14 @@ public function getTagManagerSnippet()
*/
protected function _getOrder()
{
$quoteId = Mage::getSingleton('checkout/session')->getLastQuoteId();
if ($quoteId) {
$this->_order = Mage::getModel('sales/order')->loadByAttribute('quote_id', $quoteId);
} else {
$this->_order = false;
}

$quoteId = Mage::getSingleton('checkout/session')->getLastQuoteId();
if ($quoteId) {
$this->_order = Mage::getModel('sales/order')->loadByAttribute('quote_id', $quoteId);
} else {
$this->_order = false;
}

return $this->_order;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<Fooman_GoogleAnalyticsPlus>
<version>0.16.8</version>
<version>0.16.9</version>
</Fooman_GoogleAnalyticsPlus>
</modules>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
<?php /* @var $this Fooman_GoogleAnalyticsPlus_Block_TagManager */?>
<?php /* @var $this Fooman_GoogleAnalyticsPlus_Block_TagManager */ ?>
<?php if ($this->shouldInclude()): ?>

<?php $dataLayerDetails = "";
if($this->isSuccessPage()) {
$order = $this->_getOrder();
$shipping = Mage::helper('googleanalyticsplus')->convert($order, 'shipping_amount');
$tax = Mage::helper('googleanalyticsplus')->convert($order, 'tax_amount');
$total_revenue = Mage::helper('googleanalyticsplus')->convert($order, 'grand_total');
$revenue = $total_revenue - $shipping - $tax;

$dataLayerDetails = "{
'conversion_order_id': '". $this->jsQuoteEscape($order->getIncrementId()) ."',
'conversion_store': '". $this->jsQuoteEscape(Mage::app()->getStore()->getName()) ."',
'conversion_revenue_excl_taxship': '". $revenue ."',
'conversion_revenue_shipping': '". $shipping ."',
'conversion_revenue_tax': '". $tax ."',
'conversion_revenue_revenue': '". $total_revenue ."',
'conversion_currency': '". Mage::helper('googleanalyticsplus')->getTrackingCurrency($order) ."'

<?php $dataLayerDetails = "";
if ($this->isSuccessPage()) {
$order = $this->_getOrder();
$shipping = Mage::helper('googleanalyticsplus')->convert($order, 'shipping_amount');
$tax = Mage::helper('googleanalyticsplus')->convert($order, 'tax_amount');
$total_revenue = Mage::helper('googleanalyticsplus')->convert($order, 'grand_total');
$revenue = $total_revenue - $shipping - $tax;

$dataLayerDetails
= "{
'conversion_order_id': '" . $this->jsQuoteEscape($order->getIncrementId()) . "',
'conversion_store': '" . $this->jsQuoteEscape(Mage::app()->getStore()->getName()) . "',
'conversion_revenue_excl_taxship': '" . $revenue . "',
'conversion_revenue_shipping': '" . $shipping . "',
'conversion_revenue_tax': '" . $tax . "',
'conversion_revenue_revenue': '" . $total_revenue . "',
'conversion_currency': '" . Mage::helper('googleanalyticsplus')->getTrackingCurrency($order) . "'
}";
}?>
} ?>



<script>
/* <![CDATA[ */
dataLayer = [<?php echo $dataLayerDetails?>];
/* ]]> */
</script>
<?php echo $this->getTagManagerSnippet(); ?>
<?php endif; ?>
<?php endif; ?>

0 comments on commit 1d3c15c

Please sign in to comment.