gpt4 book ai didi

php - Google Analytics 电子商务跟踪捕获不含税的价格(magento)

转载 作者:行者123 更新时间:2023-12-02 12:16:22 25 4
gpt4 key购买 nike

我正在使用 magento。为了使用谷歌分析,我在管理端启用了 GA 模块,并使用帐户 ID (UA-XXXXXXXX-1),它工作正常。现在,对于电子商务跟踪,它正在跟踪不含税的价格,例如价格 15 + 税 1 = 16,它仅捕获 15 而不是 16。我知道语法

_addItem(transactionId, sku, name, category, price, quantity)
_addTrans(transactionId, affiliation, total, tax, shipping, city, state, country)
_trackTrans()

但是在magento中我不知道它的内部工作原理。请指导我..

最佳答案

看看@

/app/code/core/Mage/GoogleAnalytics/Block/Ga.php

$result[] = sprintf("_gaq.push(['_addTrans', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s']);",
$order->getIncrementId(),
$this->jsQuoteEscape(Mage::app()->getStore()->getFrontendName()),
$order->getBaseGrandTotal(),
$order->getBaseTaxAmount(),
$order->getBaseShippingAmount(),
$this->jsQuoteEscape(Mage::helper('core')->escapeHtml($address->getCity())),
$this->jsQuoteEscape(Mage::helper('core')->escapeHtml($address->getRegion())),
$this->jsQuoteEscape(Mage::helper('core')->escapeHtml($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']);";

关于php - Google Analytics 电子商务跟踪捕获不含税的价格(magento),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20425129/

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