* @copyright Copyright (c) 2010 United Prototype GmbH (http://unitedprototype.com) */ namespace UnitedPrototype\GoogleAnalytics\Internals\Request; use UnitedPrototype\GoogleAnalytics\Transaction; use UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder; class TransactionRequest extends Request { /** * @var \UnitedPrototype\GoogleAnalytics\Transaction */ protected $transaction; /** * @return string */ protected function getType() { return Request::TYPE_TRANSACTION; } /** * @link http://code.google.com/p/gaforflash/source/browse/trunk/src/com/google/analytics/ecommerce/Transaction.as#76 * * @return \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder */ protected function buildParameters() { $p = parent::buildParameters(); $p->utmtid = $this->transaction->getOrderId(); $p->utmtst = $this->transaction->getAffiliation(); $p->utmtto = $this->transaction->getTotal(); $p->utmttx = $this->transaction->getTax(); $p->utmtsp = $this->transaction->getShipping(); $p->utmtci = $this->transaction->getCity(); $p->utmtrg = $this->transaction->getRegion(); $p->utmtco = $this->transaction->getCountry(); return $p; } /** * The GA Javascript client doesn't send any visitor information for * e-commerce requests, so we don't either. * * @param \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder $p * @return \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder */ protected function buildVisitorParameters(ParameterHolder $p) { return $p; } /** * The GA Javascript client doesn't send any custom variables for * e-commerce requests, so we don't either. * * @param \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder $p * @return \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder */ protected function buildCustomVariablesParameter(ParameterHolder $p) { return $p; } /** * @return \UnitedPrototype\GoogleAnalytics\Transaction */ public function getTransaction() { return $this->transaction; } /** * @param \UnitedPrototype\GoogleAnalytics\Transaction $transaction */ public function setTransaction(Transaction $transaction) { $this->transaction = $transaction; } } ?>