You are here

public function EventsController::getEvents in Commerce Google Tag Manager 8.2

Same name and namespace in other branches
  1. 8 src/Controller/EventsController.php \Drupal\commerce_google_tag_manager\Controller\EventsController::getEvents()

Get all tracked events as JSON.

Return value

\Symfony\Component\HttpFoundation\JsonResponse The event format as JSON.

1 string reference to 'EventsController::getEvents'
commerce_google_tag_manager.routing.yml in ./commerce_google_tag_manager.routing.yml
commerce_google_tag_manager.routing.yml

File

src/Controller/EventsController.php, line 48

Class

EventsController
A controller to receive the tracked Enhanced Ecommerce events.

Namespace

Drupal\commerce_google_tag_manager\Controller

Code

public function getEvents() {
  $events = $this->eventStorage
    ->getEvents();
  $this->eventStorage
    ->flush();
  return new JsonResponse($events);
}