コード例 #1
0
 /**
  * @link http://code.google.com/p/gaforflash/source/browse/trunk/src/com/google/analytics/ecommerce/Transaction.as#76
  *
  * @return \Plugin\GoogleAnalytics\ApiLib\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;
 }
コード例 #2
0
ファイル: Tracker.php プロジェクト: sspaeti/ImpressPages
 /**
  * Combines _addTrans(), _addItem() (indirectly) and _trackTrans() of GA Javascript client.
  * Although the naming of "_addTrans()" would suggest multiple possible transactions
  * per request, there is just one allowed actually.
  *
  * @link http://code.google.com/apis/analytics/docs/gaJS/gaJSApiEcommerce.html#_gat.GA_Tracker_._addTrans
  * @link http://code.google.com/apis/analytics/docs/gaJS/gaJSApiEcommerce.html#_gat.GA_Tracker_._addItem
  * @link http://code.google.com/apis/analytics/docs/gaJS/gaJSApiEcommerce.html#_gat.GA_Tracker_._trackTrans
  *
  * @param \Plugin\GoogleAnalytics\ApiLib\Transaction $transaction
  * @param \Plugin\GoogleAnalytics\ApiLib\Session $session
  * @param \Plugin\GoogleAnalytics\ApiLib\Visitor $visitor
  */
 public function trackTransaction(Transaction $transaction, Session $session, Visitor $visitor)
 {
     // Ensure that all required parameters are set
     $transaction->validate();
     $request = new TransactionRequest(static::$config);
     $request->setTransaction($transaction);
     $request->setSession($session);
     $request->setVisitor($visitor);
     $request->setTracker($this);
     $request->fire();
     // Every item gets a separate request,
     // see http://code.google.com/p/gaforflash/source/browse/trunk/src/com/google/analytics/v4/Tracker.as#312
     foreach ($transaction->getItems() as $item) {
         // Ensure that all required parameters are set
         $item->validate();
         $request = new ItemRequest(static::$config);
         $request->setItem($item);
         $request->setSession($session);
         $request->setVisitor($visitor);
         $request->setTracker($this);
         $request->fire();
     }
 }