public function testPaketEqualsSpecification()
 {
     /** @var Page $page */
     $page = new Page();
     $page->setDocumentPath('foo');
     $page->setDocumentTitle('bar');
     $page->setDocumentHost('baz');
     $packet = $page->getPackage();
     $this->assertEquals(array('t' => 'pageview', 'dh' => 'baz', 'dp' => 'foo', 'dt' => 'bar'), $packet);
 }
Beispiel #2
0
 /**
  * Returns the Paket for Campaign Tracking
  *
  * @return array
  * @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
  */
 public function getPaket()
 {
     $packet = parent::getPaket();
     if (!$this->getCampaignName()) {
         throw new MissingTrackingParameterException('Campaign Name musst be set');
     }
     if (!$this->getCampaignMedium()) {
         throw new MissingTrackingParameterException('Campaign Medium musst be set');
     }
     if (!$this->getCampaignSource()) {
         throw new MissingTrackingParameterException('Campaign Source musst be set');
     }
     return array_merge($packet, array('cn' => $this->getCampaignName(), 'cs' => $this->getCampaignSource(), 'cm' => $this->getCampaignMedium(), 'ck' => implode(';', $this->getCampaignKeywords()), 'cc' => $this->getCampaignContent(), 'ci' => $this->getCampaignID()));
 }