Ejemplo n.º 1
0
 public function testAddEvent()
 {
     $googleAnalytics = new CMService_GoogleAnalytics_Client('');
     $environment = new CM_Frontend_Environment();
     $js = $googleAnalytics->getJs($environment);
     $this->assertNotContains('"hitType":"event"', $js);
     $googleAnalytics->addEvent('Sign Up', 'Click');
     $js = $googleAnalytics->getJs($environment);
     $this->assertContains('ga("send", {"hitType":"event","eventCategory":"Sign Up","eventAction":"Click"});', $js);
     $googleAnalytics->addEvent('Subscription', 'Click', 'Label', 123, true);
     $js = $googleAnalytics->getJs($environment);
     $this->assertContains('ga("send", {"hitType":"event","eventCategory":"Subscription","eventAction":"Click","eventLabel":"Label","eventValue":123,"nonInteraction":true});', $js);
 }