gpt4 book ai didi

magento - 谷歌分析显示两次不同数字的magento订单

转载 作者:行者123 更新时间:2023-12-03 17:10:34 25 4
gpt4 key购买 nike

从四月份开始,两次订单都被发送到谷歌分析,奇怪的是一个格式为 9XXXXXXXXX 的可以,另一个格式为 4XXX 的不行

我不知道我应该检查什么来防止这种情况。

我的网站是 www.theprinterdepo.com,您可以使用签证号 41111111111111 自由创建演示订单

enter image description here

这段代码我在 Ga.php 中找到的

<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for 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 '';
}

/**
* Get a specific page name (may be customized via layout)
*
* @return string|null
*/
public function getPageName()
{
return $this->_getData('page_name');
}

/**
* Render regular page tracking javascript code
* The custom "page name" may be set from layout or somewhere else. It must start from 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 about specified orders and their 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 as $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() as $item) {
$result[] = sprintf("_gaq.push(['_addItem', '%s', '%s', '%s', '%s', '%s', '%s']);",
$order->getIncrementId(),
$this->jsQuoteEscape($item->getSku()), $this->jsQuoteEscape($item->getName()),
null, // there is no "category" defined for the 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 -->';
}
}

最佳答案

GA 电子商务代码在您的订单确认页面上被调用了两次。您列出的 Ga.php 中的代码似乎使用 9XXXXXXXXX 格式的订单号生成跟踪。

很难说其他 GA 电子商务跟踪代码来自哪里,但是如果您通过 Chrome 中的开发人员工具或 Firefox 中的 firebug 检查页面,您应该能够看到在正文中呈现的其他跟踪代码:

<script type="text/javascript">var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-24813807-1']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
'4598',
'English',
'34.3270',
'0.0000',
'19.4670',
'Some City',
'New York',
'United States'
]);



_gaq.push(['_addItem','4598','Q1396A','Universal 21lb Basic Bond Paper Roll 24 inch x 150ft','','14.86', '1']);
_gaq.push(['_trackTrans']);
(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';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();</script>

也许查看添加此代码的格式将帮助您搜索代码以查看您正在使用的模块是否恰好正在添加它?

关于magento - 谷歌分析显示两次不同数字的magento订单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16346995/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com