You are here

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

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

Get all tracked Enhanced Ecommerce events.

Note: If you send the events to Google Tag Manager, make sure to flush event data afterwards to prevent double tracking.

Return value

array All tracked Enhanced Ecommerce events.

File

src/EventStorageService.php, line 51

Class

EventStorageService
Stores all tracked Enhanced Ecommerce events in a private tempstore.

Namespace

Drupal\commerce_google_tag_manager

Code

public function getEvents() {
  $events = $this->tempStore
    ->get('events') ?: [];
  return array_values($events);
}