Ejemplo n.º 1
0
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('config');
     $gaConfig = $config['google_analytics'];
     $tracker = new Tracker($gaConfig['id']);
     if (isset($gaConfig['domain_name'])) {
         $tracker->setDomainName($gaConfig['domain_name']);
     }
     if (isset($gaConfig['allow_linker'])) {
         $tracker->setAllowLinker($gaConfig['allow_linker']);
     }
     if (true === $gaConfig['enable_display_advertising']) {
         $tracker->setEnableDisplayAdvertising(true);
     }
     if (true === $gaConfig['anonymize_ip']) {
         $tracker->setAnonymizeIp(true);
     }
     if (false === $gaConfig['enable']) {
         $tracker->setEnableTracking(false);
     }
     return $tracker;
 }
Ejemplo n.º 2
0
 public function testHelperReturnsNullWithDisabledTracker()
 {
     $this->tracker->setEnableTracking(false);
     $actual = $this->script->getCode();
     $this->assertNull($actual);
 }