Пример #1
0
 public function render()
 {
     $return = '';
     foreach ($this->storage->get('_trackEvent', array()) as $event) {
         $return .= sprintf("_gaq.push(['_trackEvent', '%s', '%s', '%s', %s, %s]);", $event['category'], $event['action'], $event['label'], $event['value'], $event['noninteraction']);
     }
     $this->storage->clear('_trackEvent');
     return $return;
 }
Пример #2
0
 public function render()
 {
     $return = '';
     // Render _addTrans method then clear the key in the storage
     foreach ($this->storage->get('_addTrans', array()) as $trans) {
         $return .= sprintf("_gaq.push(['_addTrans', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s']);", $trans['transactionId'], $trans['affiliation'], $trans['total'], $trans['tax'], $trans['shipping'], $trans['city'], $trans['state'], $trans['country']);
     }
     $this->storage->clear('_addTrans');
     // Render _addItem method then clear the key in the storage
     foreach ($this->storage->get('_addItem', array()) as $item) {
         $return .= sprintf("_gaq.push(['_addItem', '%s', '%s', '%s', '%s', '%s', '%s' ]);", $item['transactionId'], $item['sku'], $item['name'], $item['category'], $item['price'], $item['quantity']);
     }
     $this->storage->clear('_addItem');
     // Render _trackTrans method then clear the key in the storage
     if ($this->storage->get('_trackTrans', false)) {
         $return .= "_gaq.push(['_trackTrans']);";
     }
     $this->storage->clear('_trackTrans');
     return $return;
 }