class OfficialFacebookPixelInjection in Official Facebook Pixel 7
Same name and namespace in other branches
- 8 src/OfficialFacebookPixelInjection.php \Drupal\official_facebook_pixel\OfficialFacebookPixelInjection
Class OfficialFacebookPixelInjection.
@package Drupal\official_facebook_pixel
Hierarchy
- class \Drupal\official_facebook_pixel\OfficialFacebookPixelInjection
Expanded class hierarchy of OfficialFacebookPixelInjection
1 file declares its use of OfficialFacebookPixelInjection
File
- src/
OfficialFacebookPixelInjection.php, line 31 - Contains \Drupal\official_facebook_pixel \OfficialFacebookPixelInjection.
Namespace
Drupal\official_facebook_pixelView source
class OfficialFacebookPixelInjection {
public static function injectPixelCode() {
$options = OfficialFacebookPixelOptions::getInstance();
PixelScriptBuilder::initialize($options
->getPixelId());
self::injectScriptCode($options);
self::injectNoScriptCode();
foreach (OfficialFacebookPixelConfig::integrationConfigFor7() as $key => $value) {
$class_name = 'Drupal\\official_facebook_pixel\\integration\\' . $value;
$class_name::injectPixelCode();
}
}
public static function injectScriptCode($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();
drupal_add_html_head([
'#type' => 'markup',
'#markup' => $pixel_script_code,
'#weight' => 1000,
], 'facebook_pixel_script_code');
}
public static function injectNoScriptCode() {
// Inject inline noscript code to head
$pixel_noscript_code = PixelScriptBuilder::getPixelNoscriptCode();
drupal_add_html_head([
'#type' => 'markup',
'#markup' => $pixel_noscript_code,
'#weight' => 1000,
], 'facebook_pixel_noscript_code');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
OfficialFacebookPixelInjection:: |
public static | function | ||
OfficialFacebookPixelInjection:: |
public static | function | ||
OfficialFacebookPixelInjection:: |
public static | function |