You are here

public function PixelBuilderService::getPixelNoScriptCode in Simple Facebook Pixel 8

Gets pixel no-script code.

Return value

string The Facebook Pixel noscript code.

Overrides PixelBuilderServiceInterface::getPixelNoScriptCode

File

src/PixelBuilderService.php, line 174

Class

PixelBuilderService
Class PixelBuilderService.

Namespace

Drupal\simple_facebook_pixel

Code

public function getPixelNoScriptCode() {
  $pixels = $this
    ->getPixelIds();
  $pixels = array_map(function ($pixel_id) {
    return str_replace('{{pixel_id}}', trim($pixel_id), self::FACEBOOK_PIXEL_CODE_NOSCRIPT);
  }, $pixels);
  $no_script_code = implode(' ', $pixels);

  // Allow other modules to alter the noscript code.
  $this->moduleHandler
    ->alter('simple_facebook_pixel_noscript_code', $no_script_code);
  return $no_script_code;
}