/** * @test * @dataProvider campaigns */ public function it_tracks_a_page_with_campaign_infos($source, $campaign, $medium) { $page = '/momo/test'; $this->request->shouldReceive('get')->with('http://www.google-analytics.com/collect', array('dp' => $page, 't' => 'pageview', 'cs' => $source, 'cn' => $campaign, 'cm' => $medium, 'cid' => $this->client_id, 'tid' => $this->account, 'v' => 1)); $this->tracker->setCampaignSource($source); $this->tracker->setCampaignName($campaign); $this->tracker->setCampaignMedium($medium); $this->tracker->trackPageView($page); }
/** * Sends the data to Google Analytics. * * @param array $gif_options The request's options(optionnal). */ private function track($options) { if (!$this->client_id && !$this->account) { return; } $params = $this->buildRequestParameters($options); $url = static::ENDPOINTHOST . static::ENDPOINTPATH; return $this->request->get($url, $params); }