function facebook_pixel_page_top in Facebook Pixel 8
Implements hook_page_top().
File
- ./
facebook_pixel.module, line 63 - Contains facebook_pixel.module..
Code
function facebook_pixel_page_top(array &$page_bottom) {
$config = \Drupal::config('facebook_pixel.facebookpixelconfig');
$id = $config
->get('facebook_id');
$urlParameter = Xss::filter(urlencode($id));
$noscript = '<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=' . $urlParameter . '&ev=PageView&noscript=1" />';
$page_bottom[] = [
'#markup' => '<noscript>' . $noscript . '</noscript>',
'#allowed_tags' => [
'noscript',
'img',
],
];
}