public function trackEvent($category, $action, $label = null, $value = null)
    {
        $command = '';
        if ($label !== null) {
            $command .= ", '{$label}'";
            if ($value !== null && is_numeric($value)) {
                $command .= ", {$value}";
            }
        }

        $trackingCode = "ga('send', 'event', '{$category}', '{$action}'$command);";

        $this->trackingBag->add($trackingCode);
    }
public function trackEvent($category, $action, $label = null, $value = null)
    {
        $command = '';
        if ($label !== null) {
            $command .= ", '{$label}'";
            if ($value !== null && is_numeric($value)) {
                $command .= ", {$value}";
            }
        }

        $trackingCode = "ga('send', 'event', '{$category}', '{$action}'$command);";

        $this->trackingBag->add($trackingCode);
    }
public function trackEvent ( $ category , $ action , $ label = null , $ value = null ) { $ command = '' ; if ( $ label !== null ) { $ command .= ", '{$label}'" ; if ( $ value !== null && is_numeric ( $ value ) ) { $ command .= ", {$value}" ; } } $ trackingCode = "ga('send', 'event', '{$category}', '{$action}'$command);" ; $ this -> trackingBag -> add ( $ trackingCode ) ; }
track an event

@param string $category
@param string $action
@param null|string $label
@param null|int $value
track an event