public static function OfficialFacebookPixelInjection::injectScriptCode in Official Facebook Pixel 8
Same name and namespace in other branches
- 7 src/OfficialFacebookPixelInjection.php \Drupal\official_facebook_pixel\OfficialFacebookPixelInjection::injectScriptCode()
1 call to OfficialFacebookPixelInjection::injectScriptCode()
File
- src/
OfficialFacebookPixelInjection.php, line 45 - Contains \Drupal\official_facebook_pixel \OfficialFacebookPixelInjection.
Class
- OfficialFacebookPixelInjection
- Class OfficialFacebookPixelInjection.
Namespace
Drupal\official_facebook_pixelCode
public static function injectScriptCode(array &$page, $options) {
// Inject inline script code to head
$pixel_script_code = PixelScriptBuilder::getPixelBaseCode();
$pixel_script_code .= PixelScriptBuilder::getPixelInitCode($options
->getAgentString(), $options
->getUserInfo());
$pixel_script_code .= PixelScriptBuilder::getPixelPageViewCode();
$page['#attached']['html_head'][] = [
[
'#tag' => 'script',
'#value' => $pixel_script_code,
],
'facebook_pixel_script_code',
];
}