* @copyright Copyright (c) 2010 United Prototype GmbH (http://unitedprototype.com) */ namespace UnitedPrototype\GoogleAnalytics\Internals\Request; use UnitedPrototype\GoogleAnalytics\Item; use UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder; class ItemRequest extends Request { /** * @var \UnitedPrototype\GoogleAnalytics\Item */ protected $item; /** * @return string */ protected function getType() { return Request::TYPE_ITEM; } /** * @link http://code.google.com/p/gaforflash/source/browse/trunk/src/com/google/analytics/ecommerce/Item.as#61 * * @return \UnitedPrototype\GoogleAnalytics\Internals\ParameterHolder */ protected function buildParameters() { $p = parent::buildParameters(); $p->utmtid = $this->item->getOrderId(); $p->utmipc = $this->item->getSku(); $p->utmipn = $this->item->getName(); $p->utmiva = $this->item->getVariation(); $p->utmipr = $this->item->getPrice(); $p->utmiqt = $this->item->getQuantity(); 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\Item */ public function getItem() { return $this->item; } /** * @param \UnitedPrototype\GoogleAnalytics\Item $item */ public function setItem(Item $item) { $this->item = $item; } } ?>