You are here

function facebook_pixel_entity_insert in Facebook Pixel 8

Implements hook_entity_insert().

File

./facebook_pixel.module, line 77
Contains facebook_pixel.module..

Code

function facebook_pixel_entity_insert(EntityInterface $entity) {
  $facebook_event = \Drupal::service('facebook_pixel.facebook_event');

  // Register new user event.
  if ($entity
    ->getEntityType()
    ->id() == 'user') {

    /** @var \Drupal\facebook_pixel\FacebookEvent $facebook_event */
    $facebook_event
      ->addEvent('CompleteRegistration', $entity
      ->id());
  }
}