Google analytics is showing magento orders twice with different numbers -
since april, orders being sent twice google analytics, strange thing 1 ok format 9xxxxxxxxx, , 1 not fine format 4xxx
i have no idea should check prevent this.
my website www.theprinterdepo.com, free create demo orders visa number 41111111111111
this code found in ga.php
<?php /** * magento * * notice of license * * source file subject open software license (osl 3.0) * bundled package in file license.txt. * available through world-wide-web @ url: * http://opensource.org/licenses/osl-3.0.php * if did not receive copy of license , unable * obtain through world-wide-web, please send email * license@magentocommerce.com can send copy immediately. * * disclaimer * * not edit or add file if wish upgrade magento newer * versions in future. if wish customize magento * needs please refer http://www.magentocommerce.com more information. * * @category mage * @package mage_googleanalytics * @copyright copyright (c) 2011 magento inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php open software license (osl 3.0) */ /** * googleanalitics page block * * @category mage * @package mage_googleanalytics * @author magento core team <core@magentocommerce.com> */ class mage_googleanalytics_block_ga extends mage_core_block_text { /** * @deprecated after 1.4.1.1 * @see self::_getorderstrackingcode() * @return string */ public function getquoteordershtml() { return ''; } /** * @deprecated after 1.4.1.1 * self::_getorderstrackingcode() * @return string */ public function getorderhtml() { return ''; } /** * @deprecated after 1.4.1.1 * @see _tohtml() * @return string */ public function getaccount() { return ''; } /** * specific page name (may customized via layout) * * @return string|null */ public function getpagename() { return $this->_getdata('page_name'); } /** * render regular page tracking javascript code * custom "page name" may set layout or somewhere else. must start slash. * * @link http://code.google.com/apis/analytics/docs/gajs/gajsapibasicconfiguration.html#_gat.ga_tracker_._trackpageview * @link http://code.google.com/apis/analytics/docs/gajs/gajsapi_gaq.html * @param string $accountid * @return string */ protected function _getpagetrackingcode($accountid) { $pagename = trim($this->getpagename()); $optpageurl = ''; if ($pagename && preg_match('/^\/.*/i', $pagename)) { $optpageurl = ", '{$this->jsquoteescape($pagename)}'"; } return " _gaq.push(['_setaccount', '{$this->jsquoteescape($accountid)}']); _gaq.push(['_trackpageview'{$optpageurl}]); _gaq.push(['_trackpageloadtime']); "; } /** * render information specified orders , items * * @link http://code.google.com/apis/analytics/docs/gajs/gajsapiecommerce.html#_gat.ga_tracker_._addtrans * @return string */ protected function _getorderstrackingcode() { $orderids = $this->getorderids(); if (empty($orderids) || !is_array($orderids)) { return; } $collection = mage::getresourcemodel('sales/order_collection') ->addfieldtofilter('entity_id', array('in' => $orderids)) ; $result = array(); foreach ($collection $order) { if ($order->getisvirtual()) { $address = $order->getbillingaddress(); } else { $address = $order->getshippingaddress(); } $result[] = sprintf("_gaq.push(['_addtrans', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s']);", $order->getincrementid(), mage::app()->getstore()->getfrontendname(), $order->getbasegrandtotal(), $order->getbasetaxamount(), $order->getbaseshippingamount(), $this->jsquoteescape($address->getcity()), $this->jsquoteescape($address->getregion()), $this->jsquoteescape($address->getcountry()) ); foreach ($order->getallvisibleitems() $item) { $result[] = sprintf("_gaq.push(['_additem', '%s', '%s', '%s', '%s', '%s', '%s']);", $order->getincrementid(), $this->jsquoteescape($item->getsku()), $this->jsquoteescape($item->getname()), null, // there no "category" defined order item $item->getbaseprice(), $item->getqtyordered() ); } $result[] = "_gaq.push(['_tracktrans']);"; } return implode("\n", $result); } /** * render ga tracking scripts * * @return string */ protected function _tohtml() { if (!mage::helper('googleanalytics')->isgoogleanalyticsavailable()) { return ''; } $accountid = mage::getstoreconfig(mage_googleanalytics_helper_data::xml_path_account); return ' <!-- begin google analytics code --> <script type="text/javascript"> //<![cdata[ (function() { var ga = document.createelement(\'script\'); ga.type = \'text/javascript\'; ga.async = true; ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\'; (document.getelementsbytagname(\'head\')[0] || document.getelementsbytagname(\'body\')[0]).appendchild(ga); })(); var _gaq = _gaq || []; ' . $this->_getpagetrackingcode($accountid) . ' ' . $this->_getorderstrackingcode() . ' //]]> </script> <!-- end google analytics code -->'; } }
i had same problem , solution quite simple: had installed , enabled module tracking, forgot disable magento's core tracking capacity (under configuration>sales>google api).
Comments
Post a Comment