You are here

public function FacebookEvent::addEvent in Facebook Pixel 8

Register an event.

Parameters

string $event: The event name.

string|array $data: The event data.

bool $start_session: Force initialize a session.

Throws

\Drupal\Core\TempStore\TempStoreException

Overrides FacebookEventInterface::addEvent

File

src/FacebookEvent.php, line 61

Class

FacebookEvent
Helper methods for facebook_pixel module.

Namespace

Drupal\facebook_pixel

Code

public function addEvent($event, $data = '', $start_session = FALSE) {

  // Determine if we should use session or static storage.
  if (!empty($this->sessionManager) && $this->sessionManager
    ->isStarted() || $start_session) {
    $this
      ->addSessionEvent($event, $data);
  }
  else {
    $this
      ->addAnonymousEvent($event, $data);
  }
}